Performance penalty for using classes?
Neal Norwitz
neal at metaslash.com
Sun Jan 12 09:31:23 EST 2003
On Sun, 12 Jan 2003 03:04:43 -0500, Miki Tebeka wrote:
> I need my M.Sc. to run fast but I don't want to recode it in C. I've
> noticed that using classes can cause my code to run about 30% slower.
> (See the below tests)
Perhaps you can use Python 2.3a1. While it is only an alpha, I believe
it is very stable. It is also a little bit faster than 2.2. :-)
./python (in clean directory) is 2.3.
Neal
--
[neal at epoch clean]$ time ./python /tmp/class_test.py
Going 100000 iterations
* Done
real 0m2.197s
user 0m2.060s
sys 0m0.020s
[neal at epoch clean]$ time python2.2 /tmp/class_test.py
Going 100000 iterations
* Done
real 0m5.888s
user 0m4.900s
sys 0m0.030s
[neal at epoch clean]$ time ./python /tmp/struct_test.py
Going 100000 iterations
* Done
real 0m1.455s
user 0m1.430s
sys 0m0.010s
[neal at epoch clean]$ time python2.2 /tmp/struct_test.py
Going 100000 iterations
* Done
real 0m3.927s
user 0m3.870s
sys 0m0.020s
More information about the Python-list
mailing list