[Python-Dev] Speeding up name lookups

Oren Tirosh oren-py-d@hishome.net
Wed, 21 Nov 2001 11:24:15 -0500


On Wed, Nov 21, 2001 at 04:01:04PM +0100, M.-A. Lemburg wrote:
> Oren Tirosh wrote:
> > 
> > [Define name type for lookup purposes]
> 
> Just as note: Guido once proposed to cache (almost) all results
> of global lookups in the frame object. This causes some
> incompatibilities for e.g. global symbols that change their
> value after the first lookup.

My idea is different because cache coherence is guaranteed.  The item cached
inside the name object is a shortcut "cookie" into the entry of the real 
dictionary and its validity can be verified with just a few instructions.

> I'm not sure whether your approach goes in the same direction, 
> but I think that we might be better off using some form of descriptor
> for this than using a new type.

The thing I like about using name objects is that is touches so few places
in the code.  Any other approach I have tried resulted in chasing down 
lots of places where cache coherency might be broken and, serious changes 
to the bytecode, compiler etc.

> I'd suggest to write this up as a PEP.

The idea is still evolving too fast, soon.

	Oren