Python IS slow ! [was] Re: Python too slow for real world
Markus Kohler
markusk at bidra241.bbn.hp.com
Wed May 5 08:18:54 EDT 1999
Greg Ewing <greg.ewing at compaq.com> writes:
> 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.
Aha ...
>
> Also, it allocates each stack frame as a separate object.
> So that's at least two memory allocation/free operations
> per procedure call.
one could build a custom allocation routine that would preallocate
a block of memory. If the frame objects are the same size this could
eliminate most of the allocation/deallocation time.
>
> 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.
>
Could you explain me a bit more about the keyword args ?
What's the problem with them ?
Markus
--
Markus Kohler mailto:markus_kohler at hp.com
More information about the Python-list
mailing list