The attached, trivial, test program tests the performance of emptying a simple std::map. Using MSVC 2008 and 2010, the debug build will take <30seconds when executed from a command prompt but almost 3 minutes when executed from within the debugger. The call to clear() is entirely responsible for the difference. If I break into the debugger the callstack will always point to HeapFree.
Question: Why the huge difference? Can I somehow change debug heap settings so it'll be fast when executed in the debugger?
#include <map> int main ( int, char ) { std::map< time_t, double > test; for ( int i = 0; i < 1000000; ++i ) { test[i] = i / 3.14; } test.clear(); return 0; }