[Python-3000] Performance Notes - new hash algorithm

Gregory P. Smith greg at krypto.org
Fri Sep 7 22:45:58 CEST 2007


On 9/4/07, Thomas Hunger <hto at arcor.de> wrote:
>
>
> Hello,
>
> I don't know much about python internals, so the following might be
> bogus:
>
> I replaced unicode_hash and string_hash with the hash function from
> here: http://www.azillionmonkeys.com/qed/hash.html.
>
> Then I ran the following micro-benchmark :
>
>     $ time ./python bench.py
>
> where bech.py is:
>
>     f = dict((line, nr) for nr, line
>              in enumerate(open('/usr/share/dict/words',
>                                encoding='latin1').readlines()))
>
> Python3k original hash: real    0m2.210s
>               new hash: real    0m1.842s
>
> So maybe this is an interesting hash function?
>
> Tom


Sounds like a great idea to me.  Can you submit it as a patch?

We should run some more realistic perf tests and profiles but I imagine the
impact will only be good.

-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20070907/eef30c77/attachment.htm 


More information about the Python-3000 mailing list