Python IS slow ! [was] Re: Python too slow for real world

Christian Tismer tismer at appliedbiometrics.com
Wed May 5 09:24:17 EDT 1999


Hi Guys, I think we are missing something

Markus Kohler wrote:
> 
> Fredrik Lundh wrote:
> >
> > Markus Kohler wrote:
> > > > GvR:
> > > > Also, it allocates each stack frame as a separate object.
> > > > So that's at least two memory allocation/free operations
> > > > per procedure call.
...
> > iirc, the self people discovered that two optimizations
> > dominated everything:
> >
> > -- method and block in-lining
...
> > -- call-site caching

This is all wonderful stuff. But I think we are 
missing one point, and if I didn't go completely nuts
last night, there might be some fairly low hanging
fruit which could save 30% of runtime, at least speaking of NT.

After Markus' recommendation, I loaded a trial version of
Visual Quantify, a tool for timing of compiled code.
This tool works with optimized code very well, finds
every system call and so on.

I configured Quantify to ignore all .dll files but python15.dll
and msvcrt.dll, to get an idea where the core spends 
most of its time.

Test 1: Running python.exe with the commandline
-c "from test.pystone import *;map (lambda x:main(), range(10))"

Result time: 22.36% malloc, 14.35% free.

Test 2: Running pythonw.exe and Idle, and removing again
all system calls and Tcl/Tk calls, just keeping the two dlls as
above:

Result time: 19.47% malloc, 12.29% free.

Which tells me that if we could avoid most of these calls
and provide a very fast allocation scheme for small blocks,
I believe a single extension module would gain 25% of win!

This all under the assumption that these results were reliable.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home




More information about the Python-list mailing list