python hash function
Skip Montanaro
skip at pobox.com
Tue Jun 24 16:49:08 EDT 2003
Damien,
I took your three functions and with a couple tweaks to them and to the
PyInline module (so it could handle the "register" keyword) I came up with
the attached test script. Running it on my Powerbook yields these numbers
for three runs when hashing the words in /usr/share/dict/words (234937
words):
% python hashtest.py
hash1: 1.690 seconds, 6 collisions
hash3: 1.750 seconds, 9 collisions
hash6: 1.830 seconds, 18 collisions
% python hashtest.py
hash1: 1.710 seconds, 6 collisions
hash3: 1.800 seconds, 9 collisions
hash6: 1.840 seconds, 18 collisions
% python hashtest.py
hash1: 1.690 seconds, 6 collisions
hash3: 1.750 seconds, 9 collisions
hash6: 1.790 seconds, 18 collisions
All C code would have been compiled with Apple's version of gcc 3.1 with "-g
-O3" flags.
Skip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtest.py
Type: application/octet-stream
Size: 1312 bytes
Desc: test various string hash functions
URL: <http://mail.python.org/pipermail/python-list/attachments/20030624/f296b04f/attachment.obj>
More information about the Python-list
mailing list