[Python-Dev] More flexible namespaces.

Andrew M. Kuchling akuchlin at cnri.reston.va.us
Fri Apr 30 18:33:34 CEST 1999


Christian Tismer writes:
>Instead, If I can manage to create something like static binding
>snapshots, then I could resolve many of the lookups and internal
>method indirections, for time critical applications.

	The usual assumption is that the lookups are what takes time.
Now, are we sure of that assumption?  I'd expect the lookup code to be
like:

1) Get hash of name
2) Retrieve object from dictionary
3) Do something with the object.

Now, since string objects cache their hash value, 1) should usually be
just "if (obj->cached_hash_value!=-1) return obj->cached_hash_value";
a comparision and a return.  Step 2) should be very fast, barring a
bad hash function.  So perhaps most of the time is spent in 3),
creating new local dicts, stack frames, and what not.  (Yes, I know
that doing this on every reference to an object is part of the
problem.)  I also wonder about the costs of all the Py_BuildValue and
Py_ParseTuple calls going on under the hood.  A performance
improvement project would definitely be a good idea for 1.6, and a
good sub-topic for python-dev.

	Incidentally, what's the verdict on python-dev archives:
public or not?

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
Despair says little, and is patient.
    -- From SANDMAN: "Season of Mists", episode 0





More information about the Python-Dev mailing list