[Python-3000] Where is PyUnicodeObject->hash supposed to be set?

Nicholas Bastin nick.bastin at gmail.com
Fri Sep 7 23:13:31 CEST 2007


On 9/7/07, Guido van Rossum <guido at python.org> wrote:
> It should be set in unicode_hash(). If you compare the trunk version
> of that function with the py3k branch version, you see that it's been
> refactored, and in the refactoring, setting ->hash was omitted. It
> should be trivial to put it back.

Putting it back nets an average 1.8% performance gain for pystone, but
probably there were other cases that were extremely bad given this
behaviour.  We're still left with another 5 million 'extra' calls to
PyDict_GetItem in 3.0 over 2.6 in a 100000 cycle pystone run, so I'll
look around into those, but I suspect none of them will generate any
larger performance gain.

Someone with more experience than I in the 3.0 development cycle will
be able to determine what macro-level optimizations / refactoring make
sense, and what design decisions we're just going to have to pay for.
At the moment (and probably for the forseeable moments), I'm focusing
on small improvements across the codebase.

--
Nick


More information about the Python-3000 mailing list