Changing intobject to use int rather than long

Clarence clarence1126 at gmail.com
Tue Dec 18 14:18:05 EST 2007


On Dec 18, 6:58 pm, Hrvoje Niksic <hnik... at xemacs.org> wrote:

> I don't think changing the underlying type will help at all.  The

>
> On a 64-bit machine, that's 16 bytes for PyObject_HEAD and 8 more
> bytes for the value, 24 bytes total.  Changing long to int won't
> decrease the struct size to 20 because the compiler will pad it to 24,
> the nearest multiple of 8.  (Forcing the compiler to pack the struct
> won't help because malloc will still pad it for you.)

That's an excellent point. And true, too. Thanks, that will lay the
issue
to rest.

> If you need to store millions of integers compactly, maybe
> array.array('i') can help.




More information about the Python-list mailing list