[Python-ideas] Keep free list of popular iterator objects
M.-A. Lemburg
mal at egenix.com
Sun Sep 15 12:56:15 CEST 2013
On 15.09.2013 08:26, Kyle Fisher wrote:
> 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.
I'd suggest to open a ticket for this and then continue
the discussion there.
Given how often iterators are used nowadays in Python, a separate
free list may actually make sense (for the same reasons it makes
sense to have around for lists, tuples, etc.).
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Sep 15 2013)
>>> Python Projects, Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
2013-09-11: Released eGenix PyRun 1.3.0 ... http://egenix.com/go49
2013-09-04: Released eGenix pyOpenSSL 0.13.2 ... http://egenix.com/go48
2013-09-20: PyCon UK 2013, Coventry, UK ... 5 days to go
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/
More information about the Python-ideas
mailing list