Re: [Python-Dev] Hash to longs, and Decimal

2007-09-17 Thread Guido van Rossum
Seems a fine idea. I don't have the time for a code review but I'll
leave that up to you all.

--Guido

On 9/17/07, Facundo Batista [EMAIL PROTECTED] wrote:
 Hi everybody!

 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.

 This allows changes in Decimal that lead to a better hashing behaviour
 for big, big, really big numbers.

 The patch applies cleanly, all the tests pass ok (Mark also provided
 more tests for the hash function).

 I won't commit this right now; I'll delay the change for a couple of
 days in case somebody wants to take a look at it.

 Thanks!

 --
 .Facundo

 Blog: http://www.taniquetil.com.ar/plog/
 PyAr: http://www.python.org/ar/
 ___
 Python-Dev mailing list
 Python-Dev@python.org
 http://mail.python.org/mailman/listinfo/python-dev
 Unsubscribe: 
 http://mail.python.org/mailman/options/python-dev/guido%40python.org



-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Hash to longs, and Decimal

2007-09-17 Thread Mark Dickinson
On 9/17/07, Facundo Batista [EMAIL PROTECTED] 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
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com