Boost logo

Boost :

Subject: Re: [boost] unordered_map 32bit VS 64bit
From: Daniel James (dnljms_at_[hidden])
Date: 2012-01-26 03:16:12


On 26 January 2012 07:51, Andrey Semashev <andrey.semashev_at_[hidden]> wrote:
>
> I think, the problem of insufficient quality of a hash function should
> not be solved by the container itself. Those users who provide good
> hash functions will just waste CPU cycles if additional hash values
> mixing is done within the container.

That's really an issue for the standard (a cop out I know, but I don't
want to get into this debate).

> IMHO, the best way to address this problem is to provide a set of
> "good" hash functions for common types (I believe functional/hash
> already does this) and possibly a wrapper function that just does bit
> mixing in a user-provided hash function. Boost.Unordered docs should
> mention these tools and advise to use them to get better performance.

Actually functional/hash doesn't. It's good enough for the standard,
but no better. For numbers that fit into the hash value, it just
returns them unchanged which is fine for a prime number of buckets but
not for power of 2 containers.


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