[issue2459] speedup loops with better bytecode
Antoine Pitrou
report at bugs.python.org
Wed Mar 26 03:09:52 CET 2008
Antoine Pitrou <pitrou at free.fr> added the comment:
This new patch also updates the code generation for list comprehensions.
Here are some micro-benchmarks:
./python -m timeit -s "l = range(100)" "[x for x in l]"
Before: 100000 loops, best of 3: 14.9 usec per loop
After: 100000 loops, best of 3: 12.5 usec per loop
./python -m timeit -s "l = range(100)" "[x for x in l if x]"
Before: 10000 loops, best of 3: 24.1 usec per loop
After: 100000 loops, best of 3: 18.8 usec per loop
./python -m timeit -s "l = range(100)" "[x for x in l if not x]"
Before: 100000 loops, best of 3: 15.5 usec per loop
After: 100000 loops, best of 3: 11.9 usec per loop
Please note that this patch is orthogonal with Neal's patch in #2183, so
the two combined should be quite interesting for the list comprehensions
bytecode.
Added file: http://bugs.python.org/file9863/loops5.patch
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2459>
__________________________________
More information about the Python-bugs-list
mailing list