[issue5186] Reduce hash collisions for objects with no __hash__ method

Raymond Hettinger report at bugs.python.org
Wed Feb 11 23:04:18 CET 2009


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

At four bits, you may be throwing away information and I don't think
that's cool.  Even if some selected timings are better with more bits
shifted, all you're really showing is that there is more randomness in
the upper bits than the lower ones.  But that doesn't mean than the
lower one contribute nothing at all.

I'm *much* more comfortable with a byte-swap, rotation, or xoring-in
upper bits than with shifts that potentially destroy entropy. 
Otherwise, your taxing apps that build giant sets/dicts and need all
distinguishing bits to avoid collision pile-ups.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5186>
_______________________________________


More information about the Python-bugs-list mailing list