[Python-Dev] patch: speed up name access by up to 80% (original) (raw)

Skip Montanaro skip@pobox.com
Mon, 11 Feb 2002 14:48:36 -0600


Oren> Problem: Python name lookup in dictionaries is relatively slow.

... [ lots of interesting stuff elided ] ...

This looks pretty much like a no-brainer to me, assuming it stands up to close scrutiny. The only thing I'd change is that if PyDict_GetItem_Fast is a macro that only works for interned strings, I'd change its name to reflect its use: PyDict_GET_ITEM_INTERNED or something similar.

As a further test, I suggest you give the pystone benchmark a whirl, not because it's such a kickass benchmark, but because it occasionally fiddles global variable values. I imagine it will do just fine and probably run a bit faster to boot.

Skip