[Cython] Cython syntax to pre-allocate lists for performance

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Mar 8 00:19:53 CET 2013


Nikita Nemkin wrote:
> Sorry, accidental early send. Previous mail continued...
> 
> [None] * N makes an extra pass over the list to assign None to each item
> (and also incref None n times).

Maybe this could be optimised by adding N to the reference
count instead of incrementing it N times?

-- 
Greg


More information about the cython-devel mailing list