[Python-Dev] iterzip()

Guido van Rossum guido@python.org
Mon, 29 Apr 2002 15:55:15 -0400


> I get:
> 
>  juststore   0.93
>   justtups   0.58
>  storetups   7.61
> 
> list.append is out of the picture here.  Creating a million tuples
> goes fast so long as they're recycled, and storing a million things
> goes fast, but storing a million distinct tuples takes very much
> longer.  It's a Mystery to me so far.  How does it act on Linux?

Very reasonable with Python 2.2:

 juststore   0.95
  justtups   0.82
 storetups   1.61

But with Python 2.3 it does just about as poorly as you saw on Windows:

 juststore   0.91
  justtups   0.82
 storetups   9.40

Could it be that pymalloc somehow slows things down here?  The 2.3
tupleobject.c is nearly unchanged from 2.2, so that can't be it.

If I double the array size, the 2.3 storetups time almost quadruples:

 juststore   1.82
  justtups   1.62
 storetups  34.11

While with 2.2 it's nicely linear:

 juststore   1.91
  justtups   1.63
 storetups   3.20

Bizarre, but I know you like a challenge. :-)

--Guido van Rossum (home page: http://www.python.org/~guido/)