[Python-ideas] Keep free list of popular iterator objects
Kyle Fisher
anthonyfk at gmail.com
Sun Sep 15 08:26:00 CEST 2013
I've realized that my original example is far too complex, so I've
simplified it:
Status quo:
./python -m timeit -r 100 -s "a=[1]" "iter(a)"
10000000 loops, best of 100: 0.0662 usec per loop
With patch:
./python -m timeit -r 100 -s "a=[1]" "iter(a)"
10000000 loops, best of 100: 0.0557 usec per loop
List iter allocations: 6
List iter reuse through freelist: 1011111554
100.00% reuse rate
Which seems to show a 15% speedup. I'd be curious what others get.
Cheers,
-Kyle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130915/9649c544/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: list_iterator_freelist.patch
Type: application/octet-stream
Size: 2540 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130915/9649c544/attachment-0001.obj>
More information about the Python-ideas
mailing list