(original) (raw)


On 9/17/07, Facundo Batista <facundobatista@gmail.com> wrote:

In the Tracker Issue...

  http://bugs.python.org/issue1772851

... Mark Dickinson came with a patch that alters in a very corner case
how the hash is calculated to a long integer.


Much as I'd like this patch to be applied, I feel compelled to point out that it does have a significant(?) downside:  it slows down hashing of large integers to some degree.  


On my machine (Dual Xeon 2.8Ghz/SuSE Linux 10.2/gcc 4.1 with -O3), using timeit.timeit('hash(n)') to get timings, the new hash function takes 70% more time for 1000 digit integers, 20% longer for 100 digit integers, but has no measurable performance impact for small (int-sized) longs.  I don't know how significant this performance hit is in the larger scheme of things.

Mark