[issue14478] Decimal hashing very slow, could be cached
Jim Jewett
report at bugs.python.org
Fri Apr 6 22:14:41 CEST 2012
Jim Jewett <jimjjewett at gmail.com> added the comment:
@Jimbofbx: You are correct that a value has to be reserved to indicate that the hash hasn't been (or can't be) computed, but python uses -1 instead of zero.
An integer can't return itself because a hash is an unboxed integer; that said, there is a fast path for small enough integers. You can see the actual code at
http://hg.python.org/cpython/file/388016438a50/Objects/longobject.c#l2581
Since it is too late for 3.2, I suggest closing this and opening a separate 3.3 issue if the existing improvements are not sufficient.
----------
nosy: +Jim.Jewett
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14478>
_______________________________________
More information about the Python-bugs-list
mailing list