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

Greg Ewing greg.ewing at compaq.com
Tue May 4 18:31:10 EDT 1999


Markus Kohler wrote:
> 
> From profiling python 1.5.2c I found that python's main problem is that
> calling functions seems to be very costly.

This is just a guess, but one contributor to that might be
the way that it packs all the arguments up into a tuple,
and then immediately unpacks them again upon entering
the function.

Also, it allocates each stack frame as a separate object.
So that's at least two memory allocation/free operations
per procedure call.

A more efficient way would be to use one big stack for
all procedure calls, and just leave the parameters on
the stack in the usual case where a procedure with a
fixed number of arguments is called without any keyword
args, etc.

Greg




More information about the Python-list mailing list