Boost logo

Boost :

Subject: [boost] unordered_map 32bit VS 64bit
From: Avikam Bara-nes (avikamb_at_[hidden])
Date: 2012-01-25 02:52:33

I'm porting a project from Linux 32bit to Linux 64bit. While doing so I
notice that I have a dramatic performance degradation with unordered_map.
My platform is Ubuntu 10.4.3 64bit running on Intel Xeon X3220 but, I
tested similar program on WindowsXP SP2 64bit which running on Intel i5 and
I get the same degradation. My boost version is 1_46_1.
I use the following program in order to test unordered_map - Hop I didn't
make any copy mistakes :-).

#include <stdio.h>
#include <sys/time.h>
#include <boost/unordered_map.hpp>

int main(int argc, char *argv[])
   struct timeval tv_before, tv_after;
   boost::unordered_map<boost::int_32_t, boost::int32_t> boost_map;

   boost_map[1] = 2;
   boost_map[3] = 4;

   gettimeofday(&tv_before, NULL);
   for(int i = ; i < 100000; i++)
    gettimeofday(&tv_after, NULL);

   printf("Boost time is %f \n",
           (double)(((tv_after.tv_sec - tv_before.tv_sec) * 1000000 +
(double)(tv_after.tv_usec - tv_before.tv_usec)) / 100000));

   return 0;

I use the following compile commands:
64bit - g++ -O3 perf_test -o perf_test_64bit
32bit - g++ -m32 -O3 perf_test -o perf_test_32bit

When I run the 32bit program I get 0.5 sec
When I run the 64bit program I get 1.54 sec

Any ideas ???

Boost list run by bdawes at, gregod at, cpdaniel at, john at