[Python-Dev] patch: speed up name access by up to 80%

Oren Tirosh oren-py-d@hishome.net
Tue, 12 Feb 2002 08:29:47 -0500

On Tue, Feb 12, 2002 at 12:40:11PM +0100, M.-A. Lemburg wrote:
> * Inline small dictionary tables in the PyObject struct and only
>   revert to external tables for larger ones. (I have an old patch 
>   for this one which you might want to update)
> * Optimize perfect hashings. Sometimes (hopefully most of the times)
>   Python will generate a perfect hashing for a set of attributes.
>   In that case, it could set a flag in the dictionary object to
>   be able to use a faster lookup function.

Interesting, but I am exploring other directions now: attribute access, 
hints associated to negative entries that should speed up the next lookup 
in the chain and getting the inline/fast ratio from 3:1 up to 10:1 or 

> BTW, could you run pybench against your patch ?

18331152 fastlocal non-dictionary lookups
416661 inline dictionary lookups
131509 fast dictionary lookups
200 slow dictionary lookups

With 97% of accesses using fastlocals it's not going to have any significant