Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-03-09 09:15:26


Thorsten Ottosen wrote:
> "Daniel James" <daniel_at_[hidden]> wrote in message
> news:d0mtqf$98h$1_at_sea.gmane.org...
>> Peter Dimov wrote:
>>
>>> It is a deliberate design decision that the algorithms are fully
>>> specified. The goal is precisely to not allow you (as an
>>> implementor) to change them.. ;-)
>
>>> Of course the fact that hash_range gives the same result as
>>> hash_value on the corresponding container is no accident, either.
>>
>> Yes, the reason that this came up, is because this wasn't true for
>> Jeremy's original implementation. But I think his hash function for
>> strings was faster, which might be desirable.
>
> Peter, I don't like that hasing a string is suboptimal. Likewise,
> I would like hasing of sub_range<string> or sub_range<vector<char>>
> to be really fast.

See my other post. When talking about hash functions, you really need to
have a clear understanding of "suboptimal" in mind. I don't claim to be an
expert, but at least I have tried to familiarize myself with the research
done in this area. My advice is: if you are going to mess with a (standard)
hash function, you better (a) understand what you are doing, (b) have an
extensive test suite that benchmarks an unordered_map with a wide range of
real-world key sets.


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