New-style classes slower than old-style classes? (Was: n-body problem at shootout.alioth.debian.org)

Peter Maas peter.maas at somewhere.com
Sun Oct 8 16:43:18 EDT 2006


Richard Jones wrote:
> Giovanni Bajo wrote:
[...]
>> Anyway, this is a bug on its own I believe. I don't think new-style
>> classes are meant to be 25% slower than old-style classes. Can any guru
>> clarify this?
> 
> Please try 2.5 - there's been significant optimisation work put into 2.5

I checked that:

10000 runs of nbody.py, time in sec

           | classic | new-style |   n/c
-----------+---------+-----------+----------
python 2.4 |  2.33 s |  2.89 s   |  1.24
python 2.5 |  2.06 s |  2.61 s   |  1.27
  2.4/2.5  |  1.13   |  1.11     |    -

You are right, 2.5 is better than 2.4. But the runtime penalty
for using new-style classes remains.

-- 
Regards/Gruesse,

Peter Maas, Aachen
E-mail 'cGV0ZXIubWFhc0B1dGlsb2cuZGU=\n'.decode('base64')



More information about the Python-list mailing list