[Python-Dev] New opcode to simplifiy/speedup list comprehensions

Aahz aahz at pythoncraft.com
Sat Mar 6 09:41:10 EST 2004


On Sat, Mar 06, 2004, Raymond Hettinger wrote:
>
> If there are no objections, I would like to add an opcode for calling
> PyList_Append().  This simplifies the generated code for list
> comprehensions and reduces the overhead on each pass, improving the
> timings by about 35% on [i for i in itertools.repeat(None, 500)].

Not objections per se, but every ceval.c gets mucked with, it has a
tendency to change overall speed.  Have you checked Python benchmarks on
at least two platforms?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Do not taunt happy fun for loops. Do not change lists you are looping over."
--Remco Gerlich, comp.lang.python



More information about the Python-Dev mailing list