[Python-Dev] Accessing globals without dict lookup

Skip Montanaro skip@pobox.com
Sun, 10 Feb 2002 16:29:53 -0600


    Guido> Inspired by talks by Jeremy and Skip on DevDay, here's a
    Guido> different idea for speeding up access to globals.  It retain
    Guido> semantics but (like Jeremy's proposal) changes the type of a
    Guido> module's __dict__.

Just to see if I have a correct mental model of what Guido proposed, I drew
a picture:

    http://manatee.mojam.com/~skip/python/celldict.png

The cells are the small blank boxes.  I guess the celldict would be the
stuff I labelled "module dict".  The "func cells" would be an array like
fastlocals, but would refer to cells in the module's dict.  I'm not clear
where/how builtins are accessed though.  Is that what the extra indirection
is, or are builtins incorporated into the module dict somehow?

If anyone wants to correct my picture, the Dia diagram is at

    http://manatee.mojam.com/~skip/python/celldict

Skip