[Python-Dev] Looking for master thesis ideas involving Python

Chris Ryland cpr at emsoftware.com
Mon Nov 3 09:44:27 EST 2003

Michael Hudson wrote:
> Remove the ob_type field from all PyObjects.  Make pymalloc mandatory,
> make it use type specific pools and store a pointer to the type object
> at the start of each pool.
> So instead of
>   p->ob_type
> it's
>   *(p&MASK)
> I think having each type in its own pools would also let you lose the
> gc_next & gc_prev fields.
> Combined with a non-refcount GC, you could hammer sizeof(PyIntObject)
> down to sizeof(long)!

Yes, this is a variant of an implementation technique used in early 
Lisp and Lisp-like language systems with types (e.g., Harvard's EL-1) 
back in the early 70's (at least--that's when I first encountered it). 
In those systems, you'd use the "page #" (higher-order bits) of a 
pointer to reference a type table.

Good idea, but perhaps less effective these days where memory isn't 
quite so dear. (Back then, a large system was a PDP-10 with 256K 36-bit 
words, or around 1MB.)

--Chris Ryland / Em Software, Inc. / www.emsoftware.com

More information about the Python-Dev mailing list