This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients Arfrever, Giovanni.Bajo, PaulMcMillan, Vlado.Boza, alex, arigo, benjamin.peterson, camara, christian.heimes, dmalcolm, koniiiik, lemburg, serhiy.storchaka, vstinner
Date 2012-11-06.20:12:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
$ ./python -m timeit -s "x = b'a' * int(1E7)" "hash(x)"

Note that hash calculated only once.  Add -n 1 option and use a larger data.

> If somebody likes to play with the algorithm:

$ ./python -m timeit -n 1 -s "t = 'abcdefgh' * 10**8"  "hash(t)"
1 loops, best of 3: 4.86 sec per loop

Current hash algorithm runs 3.43 sec, V8's algorithm runs 2.44 sec.

With simple optimization I got 3.62 sec, only 6% slower than the current.

  #define U8TO64_LE(p) ((u64)((u32 *)(p))[0] | ((u64)((u32 *)(p))[1] << 32))
Date User Action Args
2012-11-06 20:12:40serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, arigo, vstinner, christian.heimes, benjamin.peterson, Arfrever, alex, dmalcolm, Giovanni.Bajo, PaulMcMillan, Vlado.Boza, koniiiik, camara
2012-11-06 20:12:40serhiy.storchakasetmessageid: <>
2012-11-06 20:12:40serhiy.storchakalinkissue14621 messages
2012-11-06 20:12:40serhiy.storchakacreate