[issue2013] Long object free list optimization

Antoine Pitrou report at bugs.python.org
Sat Mar 22 17:45:04 CET 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

Here are some updated timings against the current py3k branch:

$ ./python -m timeit "sum(range(10000))"

Without patch:
1000 loops, best of 3: 675 usec per loop
With patch:
1000 loops, best of 3: 462 usec per loop

$ ./python -m timeit -s "n=1000000" "sum(range(n, n+10000))"

Without patch:
1000 loops, best of 3: 1.36 msec per loop
With patch:
1000 loops, best of 3: 1.38 msec per loop

$ ./python -m timeit "min(range(255))"

Without patch:
10000 loops, best of 3: 18.7 usec per loop
With patch:
10000 loops, best of 3: 19.4 usec per loop

As you can see the patch makes things quite a bit better for 1-digit
long objects, and there is only a small slowdown for longer or tiny
ints. Given that 1-digit long objects should be prevalent in most code I
think it's probably a winner overall.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2013>
__________________________________


More information about the Python-bugs-list mailing list