[Python-Dev] iterzip()

Tim Peters tim.one@comcast.net
Mon, 29 Apr 2002 15:57:39 -0400

[Tim, on

def juststore(x):
    for i in x: x[i] = 0

def justtups(x):
    for i in x: 0,

def storetups(x):
    for i in x: x[i] = 0,

where x is always range(1000000)]
> ...
>  juststore   0.93
>   justtups   0.58
>  storetups   7.61
> ...
> It's a Mystery to me so far.  How does it act on Linux?

Well, it's not pymalloc here.  pymalloc is happier recycling memory than
grabbing arena after arena of persistent memory (it doesn't do what you
think here <wink> -- it creates a pool's free list "lazily", not all at
once, and that takes time).  If I recompile with pymalloc disabled, the
storetups time increases to 9.65 seconds.  So despite pymalloc's reluctance
to carve up memory until absolutely needed, it's still a lot faster than
using the system malloc for small tuples on this box.