Tim Peters wrote: > pymalloc ensures 8-byte alignment. This is one plausible reason to > keep the current int free list: an int object struct holds 3 4-byte > members on most boxes (type pointer, refcount, and the int's value), > and the int freelist code uses exactly 12 bytes for each on most > boxes. To keep 8-byte alignment, pymalloc would have to hand out a > 16-byte chunk per int object, wasting a fourth of the space (pymalloc > always rounds up a requested size to a multiple of 8, and ensures the > address returned is 8-byte aligned). Given the background information Python's long implementation could probably optimized. In 3.0 a long has 3 4-byte members (ref count, ob_size and *ob_type) plus one to many unsigned shorts (2 bytes each) to hold the value. If pymalloc aligns the objects at 8 byte address boundaries wouldn't it be better and slightly faster to use unsigned ints instead of unsigned shorts? Christian
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4