Concerns about performance w/Python, Pysco on Pentiums

Gerhard Häring gerhard.haering at opus-gmbh.net
Wed Mar 5 10:34:44 EST 2003


Peter Hansen <peter at engcorp.com> wrote:
> [hardware simulator in Python]
> On a Pentium 266 MMX, the simulator executes roughly 15000
> simulated HC12 clock cycles per second.  On a P3 866 MHz 
> chip, it can do about 85000 cycles per second.  On a P4 2GHz
> it can do about 115000 cycles per second.  The real CPU 
> runs 8 million of these clock cycles per second, and we
> were hoping for significantly better performance than we've
> seen so far.
> 
> More interesting to me, however, is the poor relative performance
> of the faster machines.  I can believe the P3 866 should be about
> 5.5+ times faster than the old P266, but the P4 is only 35%
> faster than it!

It may well be that the real bottleneck of your simulator is memory access
and not CPU. In this case you could try rewriting your Python code so that
it uses continuous memory blocks. If for example you use lists for
simulating the RAM, you could try to use the buffer module instead.

(Note, the P3 is running Win98SE, the P4 is running
> Redhat 7.3, both with their "vanilla" Python 2.2 installations,
> in the case of Linux that being the RPM from python.org.)

These use different compilers. Microsoft Visual C++ vs. (most likely) gcc
2.9.5.x.

It should be possible to squeeze more performance out of the P4 by using
gcc 3.2 or the Intel compiler instead. You should rather expect -5 to 15 %
improvement rather than an order of magnitude, though ;-)

Still this sounds like memory is the bottleneck ... You could try to look
at the cache misses for your process, if that is at all possible.

-- Gerhard




More information about the Python-list mailing list