[Python-Dev] String hash function multiplier
Guido van Rossum
guido at python.org
Tue Apr 13 23:25:03 EDT 2004
> Does anyone have any issues with changing the hash multiplier for the
> string and Unicode hash functions?
> Instead of 1000003, I would like to use Aho's 65599, a prime near 2**16
> that is efficiently expressible as (x << 6) + (x << 16) - x. This
> replaces a multiply with fast adds and shifts (with the two shifts
> potentially being executed in parallel).
> Googling for "hash 65599" shows a long history of widespread use and
> testing without any problems.
It would break the parrot benchmark, which has a re-implementation of
the hash in Python and assumes/checks at various points that the two
So I'd rather not see this changed before July 30.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev