[Python-Dev] PATCH: attribute lookup caching for 2.6

Neil Toronto ntoronto at cs.byu.edu
Fri Dec 7 04:50:47 CET 2007

Kevin Jacobs <jacobs at bioinformed.com> wrote:
> On Dec 6, 2007 1:35 AM, Neil Toronto <ntoronto at cs.byu.edu 
> <mailto:ntoronto at cs.byu.edu>> wrote:
>     So I've applied Armin's patch to 2.6 (it was nearly clean) and am
>     playing with it. cls.name <http://cls.name> lookups are 15-20%
>     faster than mine, and
>     inst.name <http://inst.name> lookups are 5-10% faster. His is also
>     winning on hasattr calls
>     (succeeding and failing) on classes, but mine is winning on hasattr
>     calls on instances. I want to poke at it a bit to find out why.
> I hope folks have noticed that I've done some significant cleanup and 
> forward porting some months ago at
> http://bugs.python.org/issue1700288

Excellent. I tried this as well. This is guarding cache access with 
PyString_CheckExact (as it should) rather than asserting PyString_Check, 
plus a few other cleanups. It runs nearly as fast as Armin's, and still 
faster than mine and much faster than without.


More information about the Python-Dev mailing list