"Stefan Behnel" <stefan...@behnel.de> wrote in message
news:mailman.563.1283921317.29448.python-l...@python.org...
BartC, 08.09.2010 03:45:
Getting back to the OP's code again (trivial and pointless as it might
seem), I got these results:
C (gcc 3.4.5 -O3) 0.8 secs
C (DMC-o) 2.3 secs
C (lccwin32 -O) 2.9 secs
BTW, I wonder why the code takes a whole 0.8 seconds to run in your gcc
test. Maybe you should use a newer GCC version. It shouldn't take more
than a couple of milliseconds (for program startup, OS calls, etc.), given
that the output is a constant.
It turns out the 0.8 second version cheats. It counts to a billion, but does
not do the work asked (a=a+10).
The fastest time that will do what it is requested, is about 1.2 seconds,
when register-based, and about 3 seconds when memory-based.
This reduces the slowdown on Python 3 from 220x to 150x, and down to 60x
when register-versions are not counted (as use of registers can't be
guaranteed). (Python 2 was about 20% faster.)
--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list