Boost logo

Boost :

Subject: Re: [boost] unordered_map 32bit VS 64bit
From: Daniel James (dnljms_at_[hidden])
Date: 2012-01-25 18:35:06


On 25 January 2012 19:05, Grund, Holger (ISGT)
<Holger.Grund_at_[hidden]> wrote:
>>
> My guess would be that there is 64-bit division for transforming the hash to a bucket index, which is killing perf
> (though one would wonder why there are no peeps for an instructions like MOD(1,x) in the codegen).

You're right. I tried removing all the modulus calculations from the
container (fine in this case since it's only ever looking for hash
values < 4 - I'm also using a modified benchmark which looks up i % 4
rather than 1, to stop things getting optimised away), and the
difference became much smaller. I didn't realise how expensive they
are on 64 bit computers, I think I might change the design of the
container to reduce the number of times they're used, although that
will make some other things a bit slower.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk