[Python-Dev] int/float freelists vs pymalloc
Neal Norwitz
nnorwitz at gmail.com
Fri Feb 8 20:01:40 CET 2008
More information about the Python-Dev mailing list
Fri Feb 8 20:01:40 CET 2008
- Previous message: [Python-Dev] int/float freelists vs pymalloc
- Next message: [Python-Dev] int/float freelists vs pymalloc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Feb 8, 2008 10:54 AM, Christian Heimes <lists at cheimes.de> wrote: > Andrew MacIntyre wrote: > > However, my tests do show that something is funny with the current > > freelist implementation for floats on at least 2 platforms, and that > > doing without that sort of optimisation for float objects would likely > > not be a hardship with PyMalloc. > > float objects are slightly larger than int objects. On a 32bit OS both > have ob_type pointer of size 4, a ref counter of size 4. But an int > object has a value of type long with 4 bytes and a float stores its > value in a double with size 8. > > I assume that the difference in size leads to a different allocation timing. It's not just size. Architectures may require data aligned on 4, 8, or 16 addresses for optimal performance depending on data type. IIRC, malloc aligns by 8 (not sure if that was a particular arch or very common). I don't know if pymalloc handles alignment. n
- Previous message: [Python-Dev] int/float freelists vs pymalloc
- Next message: [Python-Dev] int/float freelists vs pymalloc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list