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

Adam Olsen report at bugs.python.org
Wed Feb 11 21:59:40 CET 2009


Adam Olsen <rhamph at gmail.com> added the comment:

Antoine, I only meant list() and dict() to be an example of objects with
a larger allocation pattern.  We get a substantial benefit from the
sequentially increasing memory addresses, and I wanted to make sure that
benefit wasn't lost on larger allocations than object().

Mark, I concede the point about rotating; I believe the cost on x86 is
the same regardless.

Why are you still only rotating 3 bits?  My results were better with 4
bits, and that should be the sweet spot for the typical use cases.

Also, would the use of size_t make this code simpler?  It should be the
size of the pointer even on windows.

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


More information about the Python-bugs-list mailing list