Boost logo

Boost :

Subject: Re: [boost] unordered_map 32bit VS 64bit
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2012-01-25 07:33:01

Avikam Bara-nes wrote:
> 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 presume that you've ensured that there's sufficient memory available for the 64b process? That is, it isn't suffering from swapping, is it?

> 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;

Out of curiosity, what happens if you use int64_t instead of int32_t?

> 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

Have you tried -O2 or -O1 to see if they make any difference?

Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP


IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

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