[Python-Dev] 2.5 slower than 2.4 for some things?
ocean
ocean at m2.ccsnet.ne.jp
Thu Jun 14 04:37:08 CEST 2007
> > Probably I found one reason comparation for classic style class is
slower on
> > Python2.5.
> > Comparation function instance_compare() calls
PyErr_GivenExceptionMatches(),
> > and it was just flag operation on 2.4. But on 2.5, probably related to
> > introduction of BaseException,
> > it checks inherited type tuple. (ie: PyExceptionInstance_Check)
>
> I'm curious about the speed of 2.6 (trunk). I think this should have
> become faster due to the introduction of fast subtype checks (he says
> without looking at the code).
>
> n
>
Yes, I confirmed trunk is faster than 2.5.
///////////////////////////////////////
// Code
import timeit
t = timeit.Timer("""
f1 < f2
""", """
class Foo:
pass
f1 = Foo()
f2 = Foo()
""")
print t.timeit(10000)
///////////////////////////////////////
// Result
release-maint24 0.337sec
release-maint25 0.625sec
trunk 0.494sec
//////////////////////////////////////
// Result of plex_test2.py
release-maint24 2.944sec
release-maint25 4.026sec
trunk 3.625sec
More information about the Python-Dev
mailing list