[Python-Dev] Accessing globals without dict lookup

Fred L. Drake, Jr. fdrake@acm.org
Tue, 12 Feb 2002 11:16:27 -0500

Tim Peters writes:
 > Vanilla pymalloc is perfect for this:  many small objects.  A custom free
 > list for cells is a waste of code, because a cell never goes away until the
 > module does:  cells will not "churn".  We'll get a lot of them, but most of
 > them will stay alive until the program ends, so the tiny performance gain
 > you may be able to get from a thoroughly specialized free list "in theory"
 > will never be realized in practice.

Have we become convinced that these cells need to be Python objects?
I must have missed that.  As long as we can keep them simple
structures, we should be able to avoid individual allocations for
them.  It seems we have a fixed number of cells for both module
objects and function objects (regardless of whether they are part of
the new celldict or the containing function or module), so they can be
allocated as an array rather than individually.

So, I must be missing something.


Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation