DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope
DLL seriously affected by vbl scope DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
Go Back  Xtreme Visual Basic Talk > > > DLL seriously affected by vbl scope


Reply
 
Thread Tools Display Modes
  #1  
Old 02-22-2017, 09:19 PM
Mathimagics's Avatar
MathimagicsDLL seriously affected by vbl scope Mathimagics is offline
Algorithms 'R' Us

Forum Leader
* Guru *
 
Join Date: Jun 2002
Location: Canberra
Posts: 4,159
Default DLL seriously affected by vbl scope


I have obtained a SAT solver (MiniSAT) which is written in C++.

So I used MS VS 2008 to build it. It comes with a front-end which reads CNF from a text file, and invokes the Solver, which is implemented as a class, by invoking its Solve method.

So the main procedure looks something like this:
Code:
    void main(args) {
       Solver S;
       LoadCNF(fname, S);  // parse the CNF file
       S.Solve();          // solve the system
       }
Next I make a DLL version, so for a first version I simply replace that main with an exported function, CallMe(char *fname).


Both EXE and DLL versions give the same results in the same time, which for a particular CNF test file this happens to be about 50ms. So far so good!

Now, at some stage I accidentally moved that Solver S; declaration out of the function so it became "global", ie:
Code:
    Solver S;

    void CallMe(char *fname) {
       LoadCNF(fname, S);  // parse CNF file
       S.Solve();          // solve the system
       }
This had absolutely no effect on the EXE version, but in the DLL it is catastrophic - it now takes 325s to give the same result, a degradation factor of over 5000!

Can anybody suggest why this might be so? It seems to be some sort of code-generation issue that only affects the DLL.

I know that the Solver class has lots of inlined methods, and perhaps these are not being inlined?

However, I understand this problem should only happen if I was exporting any the class/methods, which I am not doing.
__________________
Cogito, ergo codo
Reply With Quote
  #2  
Old 02-23-2017, 01:53 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

Not a C++ kinda person here, but this Link might give some clue's
__________________
As finishing touch, god created the Dutch!

utterly useless, but always trying to help
Reply With Quote
Reply

Tags
solver, dll, file, cnf, solve, version, class, void, parse, exe, callmechar, function, system, s.solve;, loadcnffname, main, inlined, takes, result, catastrophic, exporting, happen, 325s, global, absolutely


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
DLL seriously affected by vbl scope DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
 
DLL seriously affected by vbl scope
DLL seriously affected by vbl scope
 
-->