[Python-Dev] Possible low-hanging optimization

Kevin Jacobs jacobs@penguin.theopalgroup.com
Thu, 12 Dec 2002 13:06:17 -0500 (EST)


On Thu, 12 Dec 2002, David Abrahams wrote:
> In Boost.Python, extension class instance dictionaries are created
> only on-demand.  It's an obvious win for lots of wrapped C++ class
> instances, which will never have Python attributes tacked on.  This
> also seems like a potential big win for some kinds of Python
> instances, like those which use __slots__ but may also have a
> dictionary (IIRC that is a possible configuration).

I am fairly confident that CPython doesn't allocate instance dictionaries
until they are needed.  At one point I verified this, though my brain and
the code has likely diverged much since there.

-Kevin

--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com