[Python-3000] Performance Notes (original) (raw)

Thomas Hunger hto at arcor.de
Tue Sep 4 18:49:48 CEST 2007


I've been doing some profiling of 3.0 vs. 2.6 release builds on Windows XP for the purpose of hopefully closing the performance gap. This data is very preliminary, but I thought I'd throw it out here in case someone else also wanted to look into this. Also, possibly useful for comparing against profiling data on other platforms. The table below just lists functions and speed differentials in 3.0 vs. 2.6, ordered by the functions in which we spend the most total time.

Hello,

I don't know much about python internals, so the following might be bogus:

I replaced unicode_hash and string_hash with the hash function from here: http://www.azillionmonkeys.com/qed/hash.html.

Then I ran the following micro-benchmark :

$ time ./python bench.py

where bech.py is:

f = dict((line, nr) for nr, line
         in enumerate(open('/usr/share/dict/words',
                           encoding='latin1').readlines()))

Python3k original hash: real 0m2.210s new hash: real 0m1.842s

So maybe this is an interesting hash function?

Tom



More information about the Python-3000 mailing list