Python Productivity over C++

Bijan Parsia bparsia at email.unc.edu
Tue Jun 13 18:00:50 EDT 2000


Juanjo Álvarez <jajs at NOSPAMretemail.es> wrote:

> Courageous dijo sobre Re: Python Productivity over C++,
> en fecha: Mon, 12 Jun 2000 06:33:05 GMT
> 
> |Python is a simply wonderful prototyping environment, IMO.
> |Now only if it had an optimizing compiler...
> 
> I think every Python fan dream with that... 
> 
> It's really so difficult?

1) Look at Vyper, a Python clone+extensions. I haven't heard much about
it in a while. It looked very promising to me. It intended to do a lot
with whole module/program analysis, espeically wrt to type inferencing.
For compiling to machine code executables, this seems like a very good
approach. Stalin (a scheme compiler) takes this path, plus giving up
some runtime dynamaticity (well, you kinda have to if you're going to
analyize the *whole* program) and it achieves quite amazing code.
Outpaced C for certain numeric code, where reasonably idiomatic C and
Scheme were used, and even when someone skanky C was thrown in, IIRC.

2) Common Lisp style compiler. Big grab bag of tricks there, including
optional type declarations. Probably not quite the right match for
Python.

3) Smalltalk/Self style VMs. Improving method/function dispatch alone
can do a hell of a lot, as simple hand optimization shows (e.g., binding
a function to a local variable in an inner loop). Self style is more
ambitious, and probably not worth the implementation effort.

My understanding is the CPython VM is designed for simplicity,
portability, embedability, and easy of using C for extendability. Not
speed. My guess is that one of these has to be reduced for speed to go
up. Acutally, more than one, since simplicity will always be compromised
as you at optimization, and if you add trying to preserve all the
others, you get more complicated quickly.

Vyper shows, in a preliminary way (as does JPython), that there may be
serious gains made by moving to a different, higher level implementation
language. There are indeed some whispers of YA implementation...

...but if I told you about it, you'd tell me back, and then you'd have
to kill me, and my life insurance isn't paid up.

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




More information about the Python-list mailing list