Concerns about performance w/Python, Pysco on Pentiums
peter at engcorp.com
Fri Mar 7 23:22:02 CET 2003
Michael Hudson wrote:
> Peter Hansen <peter at engcorp.com> writes:
> > Tentative conclusion: although it's at the bottom of the range of
> > claimed improvements from Psyco, I'll take my 36% and run. I'll
> > switch to lists, because dicts have zero advantages in this case,
> > though the speedup is minor.
> Have you tried Python 2.3a2? You might like what you see (pymalloc is
> probably the main reason for the improvement, but there have been
> many, many little performance tweaks).
I feel bad for not having tried the alpha on more stuff, so I took
your suggestion and started running a variety of things through it.
(No bugs yet! :-)
Here is a summary of the results, this time from my P266MMX machine.
The units are "pseudo-Hz" which are meaningless in real-world terms,
but the performance relative to baseline is shown too.
Python 2.2 results
Py2.2, dict, no Psyco: 15198, 100% (== 2.2 baseline)
Py2.2, list, no Psyco: 15320, 101%
Py2.2, tuple, no Psyco: 14918, 98%
Py2.2, list, Psyco: 18629, 123%
For Python 2.3 (values relative to 2.2 baseline)
Py2.3, dict, no Psyco: 17900, 118% (== 2.3 baseline)
Py2.3, list, no Psyco: 17923, 118%
Py2.3, tuple, no Psyco: 17149, 113% (or 96% of 2.3 baseline)
(Of course, Psyco is not released for 2.3 yet (unless it's in CVS)
so I don't have those results.)
I don't think I expected a large increase with 2.3, as the program
pre-allocates almost everything and does little, except creating
the odd integer value beyond 100 as the program runs.
I also tried inlining the step() method in the run() method,
as CezaryB suggested. (Using locals in the way he suggested is not
possible, as the instance variables are required by the various
methods that are called.)
Py2.2, list, inlined: 16468, 108%
Py2.3, list, inlined: 19074, 126%
Py2.2, list, inlined, Psyco: 9963, 66% (!)
Not sure what that last one indicates, except that under certain
circumstances (perhaps when used by someone who hasn't even read
it's documentation? :-), Psyco can produce *worse* results.
More information about the Python-list