[Python-Dev] proposal: add basic time type to the standard library (original) (raw)

Tim Peters tim.one@comcast.net
Sat, 09 Feb 2002 15:48:21 -0500


[Tim]

WRT RAM usage, a Python int is no smaller than a TimeStamp object.

[Guido[

Wrong, unless TimeStamps also use a custom allocator.

Good point, and it doesn't (it uses PyObject_NEW).

I don't think counting fractions of bytes is of great interest here, though, since I (still) believe it's the massive Zope DateTime type that's the focus of complaints.

The custom allocator uses 12 bytes per int (on a 32-bit machine) and incurs malloc overhead + 8 bytes of additional overhead for every 82 ints. That's about 12.2 bytes per int object; using malloc it would probably be 24 bytes. (PyMalloc would probably do a little better, except it would still round up to 16 bytes.)

pymalloc overhead is a few percent; would work out to 16+f bytes per int object, for some f < 1.0. A difference is that "total memory dedicated to ints" never shrinks using the custom allocator, but can get reused for other objects under pymalloc.