To quickly and simply run this script (I was just doing a timing/syntax test):
[int GetNumber() { return GetOtherNumber()*2; }
int GetOtherNumber() { int aResult=0; for (int aCount=0;aCount<2000000;aCount++) { aResult+=2; aResult-=1; } return aResult; }
And with the release .lib, it takes about 45-50ms, but with the debug.lib, it takes only 30-35ms... that's right, the debug runs about a third faster than the release.
Angelscript.lib is almost 6mb, and the angelscriptd.lib is about 3.5.
That's not correct, right? These are reversed somehow, no? I looked at the projects, and they all look okay, but I can't believe this isn't backwards unless someone explicitely tells me so.
I used the MSVC10 project, used .lib files out of the box from the download-- only thing I switched was to use multi-threaded instead of multi-threaded DLL, so that it matched my projects.
Is the size right? If that's right, then I'll assume the slowdown is coming from my project settings somehow. If I execute the script 100 times, then it's slightly faster in release mode, so could this just be one of those things?
I use MSVC9 myself, and for me the debug version is about 5 times slower than the release version in my tests.
The size of the library in release mode is probably because of the option Enable link-time code generation (/GL). With this option the library will include a lot more information in order to allow inlining and other types of final optimizations. Turning off this makes the library about 6 times smaller on MSVC9.
It is quite possible the compilation flags in the library for MSVC10 are not properly configured for the best possible optimizations.
Turning off /GL fixed both problems. Maybe MSVC10 has a bug? It lists /GL as "whole program optimization" so maybe it's optimizing so hard, it ends up unoptimizing, like a politician.
It's possible. Some optimizations are theoretically good but in practice end up being slower, for example function inlining or rolling ou loops. While in you'd optimize a few instructions the code is larger and may end up getting more cache misses.