Category ArchiveCode
C++ 09 Jul 2009 11:43 pm
C++ Map Speeds, GNU g++ Edition
(There is also an MSVC++ Edition of these performance tests, and a newer std::set comparison.)
While testing whether anything would break by switching to std::tr1::unordered_map for CG-3, I noticed it ran a consistent 15% faster. So, for my own curiousity, I threw together this little speed test: timemap.cpp with cycle.h.
Should be compiled with GCC g++ of at least version 4.3 to have TR1, and with -O2 or higher; -O will not optimize the hash maps sufficiently.
Now, that is obviously a naive test. Maps of integer to integer is a trivial case, but it is also a case I use often in CG-3 so I figured it would suit fine for a test.
Continue Reading »