Python Performance
Markus Stenberg
mstenber at cc.Helsinki.FI
Mon Jul 26 07:42:31 EDT 1999
"M.-A. Lemburg" <mal at lemburg.com> writes:
> Markus Stenberg wrote:
> > ...
> > Thus I've had great deal of interest in getting the speed up; however,
> > speeding up dynamic interpreted languages is nontrivial, especially
> > languages as dynamic as Python.
> There are various ways to enhance Python's performance. Here
> are some links:
>
> http://www.automatrix.com/~skip/python/
> http://lima.mudlib.org/~rassilon/p2c/
>
> The most trivial trick is to eliminate global lookups by "localizing"
> them. Others include turning to C functions (see mxTools on my
> Python Pages) or using specialized Python extensions (calls
> to builtin functions are noticeably faster than Python function
> calls).
Skip's page contains some valid hints, although haven't tried the optimizer
et al. Python2C page doesn't seem to work, and it does _not_ speed up
object-oriented programs very much (non-OO, yes; OO, negligibly) yet
consumes space like hell.
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.
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
-Markus
--
"One World, One Web, One Program" - Microsoft Promotional Ad
"Ein Volk, Ein Reich, Ein Fuhrer" - Adolf Hitler
We don't see a similarity. We really don't.
More information about the Python-list
mailing list