[Python-Dev] Joys of Optimization
Delaney, Timothy C (Timothy)
tdelaney at avaya.com
Sun Mar 14 23:29:40 EST 2004
> From: Raymond Hettinger [mailto:python at rcn.com]
>
> If you're up for a couple of more runs, I would appreciate
> independent
> timing and testing of my dictionary freelist patch,
> www.python.org/sf/916251 , which may or may not be an improvement.
I'll see what I can do ... I'm still fairly shakey on FreeBSD - this is the first time I've *really* set it up. Spent 2.5 days building KDE 3.2 from ports because I couldn't work out how to make portupgrade install a new port from packages (yes - I now know it's portupgrade -N or portinstall ;)
> Also, here are additional fun scorecards that will probably also all
> show wins (too bad you can't measure memory consumption or code volume
> which also improved):
>
> python timeit.py -r9 "[1].pop()"
> python timeit.py -r9 -s "a=[];b=a.append;c=a.pop" "b(1);c()"
> python timeit.py -r9 "[None]*500"
> python timeit.py -r9 -s "dc={}.__contains__" "dc(1)"
> python timeit.py -r9 -s "a=b=[None]*500" "a+b"
> python timeit.py -r9 -s "a=[None]*500" "a[:]"
> python timeit.py -r9 -s "a=(None,)*50" "list(a)"
> python timeit.py -r9 -s "import itertools"
> "list(itertools.repeat(None,500))"
> python timeit.py -r9 -s "import itertools"
> "list(itertools.chain(xrange(500)))"
> python timeit.py -r9 "xrange(500)"
> python timeit.py -r9 -s "a=[1]; ag=a.__getitem__", "ag[0]"
Fun! Of course, I'll only be comparing between 2.3 and 2.4 (+ psyco) for any additional stuff. 2.3 was such a huge win over earlier versions.
Tim Delaney
More information about the Python-Dev
mailing list