Python Performance

Markus Kohler markusk at bidra241.bbn.hp.com
Mon Jul 26 11:49:03 EDT 1999


Markus Stenberg <mstenber at cc.Helsinki.FI> writes:

[deletia]
> 
> None of them touch my primary speed problem; the function/method
> invocation 'speed'; C++ function/method invocation seems 200+ times as fast
> as Python's, and it really limits the proper OO nature of things,
> especially while using apply (another 4x slowdown). Deep class hierarchies
> seem no-go, as do several other things.

Yes function invocation is slow with Python. One could argue that this is
because python is more dynamic than C++ for example. But then take a
look at Smalltalk. I found that the calling speed of Visualworks
Smalltalk on HP-UX is just a bit faster than the calling speed of HP's 
C++ compiler. 

My guess is that what calling speed makes slow on Python are all those
different kinds of ways to call the same function. 
Examples are default arguments and named arguments. 
IHMO these features may save some typing but they are not worth
sacrifying performance nor do they help increasing readability of the
code. 

> 
> Although even with 1000x slowdown, my Python runs almost as fast as
> assembly on A500.. hmm. ;-)
> 
> To my regret I've had to muck too much with C++ recently :P
> 

That's exactly what  we all would like to avoid don't we ?

Markus
-- 
Markus Kohler  mailto:markus_kohler at hp.com




More information about the Python-list mailing list