Why is Python so slow ?- revisited.

Bijan Parsia bparsia at email.unc.edu
Wed Jun 21 16:24:05 EDT 2000


Paul Prescod <paul at prescod.net> wrote:

> Actually, I think that a method cache for Python has been implemented.

Really? How interesting.

> I
> think that the main reason that it isn't "standard" is that Guido wanted
> to preserve the simplicity of the Python *implementation*. In general
> this is important because we want many people to poke around in Python's
> internals and not just a tiny inner circle. 

I'd be interested to know whether, as has been indicated, the cache
makes things *especiallyh* complex. <sigh/>I'd love it if someday we
could get someone (er...C literate :)) to compare the code for the
Python VM and the Squeak VM, since one of the big design goals for the
Squeak on is (likewise) implementation simplicity.

> Of course, any particular optimization could be so attractive that it
> overwhelms this concern...but in general Guido does not take the
> approach where you try to cram in every cool optimization you can find.

Oh, definitely. (I have definitely strayed from empircal grounds :)) I
guess I've thought that given the example of Squeak (having a method a
cache, having a reputedly simple implementation, and seeming to benefit
greatly from the cache), and the very high cost of function/method
lookup in Python, that a method cache in Python would be a big win
without (necessarily) compromising implementation simplicity.

But, thus far, my speculation seems to be mistaken :). Thomas hasn't
*quite* convinced me on the complexity, yet, but probably because I
don't understand him! He (and others) have also suggested that the
speedup might not be that great. I wonder, however, if that's in part
due to avoiding coding patterns that would be greatly penalized by the
lookup times. (Of course, even if that were true, it doesn't help with
the task of speeding up *existing* Python code.)

If there is method cache code lying about, it might be fun to share it
out, even if it doesn't make it into the regular release.

(Indeed, having a base, simple, wildly ported version and a hacked to
help, crufty, speedy version of the VM would seem to have a fairly wide
audience :))

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



More information about the Python-list mailing list