Why is Python so slow ?- revisited.

Bijan Parsia bparsia at email.unc.edu
Thu Jun 22 13:22:51 EDT 2000


Michael Hudson <mwh21 at cam.ac.uk> wrote:

> bparsia at email.unc.edu (Bijan Parsia) writes:
> 
> > William Dandreta <wjdandreta at worldnet.att.net> wrote:
> [snip]
> > > In addition, there are 3 function calls in each replace. Logic
> > > says eliminating one improve speed by 1/3.
> > 
> > Er.. no logic I know of :) Remember that "obvious" reasoning typically
> > leads you astray when thinking about optimization. 
> 
> Hear hear.

Too bad I don't always follow my own excellent advice.

> > The key, as I have written, is the *lookup* of the method/function.
> 
> Are you really sure about this?

No. :)

>  I was under the impression that it
> was the cruft at the top of eval_code2 in ceval.c that was the major
> overhead of a function call.  It certainly is in some circumstances,
> though I guess it may be possible that in others method lookup
> dominates.  Do you have numbers?

Nope. :( *Bad* Bijan! I was relying on the perhaps misinterpreted
reports of others. Which may also be a touch dated.

Ack, caught in a "common wisdom" fallacy in the very same *breath*
wherein I complain of another! Sheesh. ;)

[snip]
> > Try saving the function to a local var and using it. I'd be interested
> > to see what happens.
> 
> Does Python 1.2 have the local variable optimisation? 

What do you mean?

[snip]


-- 
Bijan Parsia
http://monkeyfist.com/
...among many things.



More information about the Python-list mailing list