[Python-Dev] class attributes slower in py3k

Antoine Pitrou solipsis at pitrou.net
Wed Aug 27 01:13:13 CEST 2008


Antoine Pitrou <solipsis <at> pitrou.net> writes:
> > >          NormalClassAttribute:    339ms    340ms    0.28us    1.111ms
> > 
> > Over twice as slow?
> 
> Yes, should be investigated.
> 
[...]
> 
> > >         SpecialClassAttribute:    534ms    535ms    0.45us    1.121ms
> > 
> > ~4x slower!
> 
> Should be investigated as well.

It turns out that these two slowdowns are due to classes always being new-style
in py3k. Indeed, if I add "__metaclass__ = type" at the beginning of
Tools/pybench/Lookups.py, 2.6 becomes as slow as 3.0.

Regards

Antoine.




More information about the Python-Dev mailing list