[Python-Dev] Joys of Optimization (original) (raw)
Raymond Hettinger python at rcn.com
Sun Mar 14 22:41:51 EST 2004
- Previous message: [Python-Dev] Joys of Optimization
- Next message: [Python-Dev] Joys of Optimization
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I did a bit of benchmarking of various versions on my FreeBSD box ... I may have got a bit carried away ;)
Am still reading the details of your thorough posting. Excellent documentation, thank you.
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.
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]"
Raymond Hettinger
- Previous message: [Python-Dev] Joys of Optimization
- Next message: [Python-Dev] Joys of Optimization
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]