[Python-Dev] int/float freelists vs pymalloc

Andrew MacIntyre andymac at bullseye.apana.org.au
Sat Feb 9 00:02:38 CET 2008

M.-A. Lemburg wrote:

> As you can see, Integers and floats fall into the same pymalloc size
> class. What's strange in Andrew's result is that both integers
> and floats use the same free list technique and fall into the same
> pymalloc size class, yet the results are different.

My take is not that PyMalloc is so much better in the float case, but
that the float freelist implementation is suboptimal (though exactly
why is subject for conjecture, given it's almost identical to the int

> The only difference that's apparent is that small integers are
> shared, so depending on the data set used for the test, fewer
> calls to pymalloc or the free list are made.

My testing was done with millions of unique integers, so the small int
handling should be deep in the measurement noise.

Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
        andymac at pcug.org.au             (alt) |        Belconnen ACT 2616
Web:    http://www.andymac.org/               |        Australia

More information about the Python-Dev mailing list