> Then there's also the question of whether you are using VS2010 in
> "secure" mode, which does a lot of potentially-expensive error checking
> that Boost does not, at least by default.
That was enabled by default in VC8/9 release mode (_SECURE_SCL=1), but
is disabled by default in VC10 release mode (_ITERATOR_DEBUG_LEVEL=0).
Our exhaustive correctness checks, including iterator invalidation,
are still enabled by default in debug mode (_HAS_ITERATOR_DEBUGGING=1
in VC8/9, _ITERATOR_DEBUG_LEVEL=2 in VC10). Of course, debug mode perf
is not interesting, except when it makes programs so slow as to be un-
debuggable. In related news, unordered_map sometimes had severe perf
problems under IDL=2; we believe we've entirely squashed them in VC11.
> This seems to be a clear answer to your question: The observable
> difference is due to the quality of the default hasher.
Coincidentally, I just finished working on changes to clean up our
std::hash implementation. I'm measuring hash<int> as 2.2x faster than
VC10 SP1, and hash<unsigned long long> as 7.5x faster.
My new approach (which still has to be sent to Dinkumware for review
and integration) can be summarized as "throw FNV-1a at the problem".
> Did you make sure that you're measuring optimized release build, and,
> for VS implementation, did you set SECURE_STL to 1?
It's spelled _SECURE_SCL, and 1 means "enable slower security checks".
The default of 0 means "superspeed mode, absolutely no checking
(except integer overflow in memory allocation)".
Stephan T. Lavavej
Visual C++ Libraries Developer