A faster Python?, Python compiler, Dylan,...

Michael Hudson mwh at python.net
Wed Apr 3 12:07:48 EST 2002


Jan Kybic <kybic at ieee.org> writes:

> > > It would be so much easier if I could just compile parts of the
> >                                         ^^^^
> > You make it sound so simple...
> 
> Well, translating something like:
> 
> 
> def fib(a):
>         if a <= 2: return 1
>         else: return fib(a-2) + fib(a-1)
> 
> into:
> 
>  int fib(int a) {                   
>      if(a <= 2) return 1;
>         else return fib(a-2) + fib(a-1);  }
> 
> does indeed seem to be simple, once you know that 'a' is an integer.

Just picking, but the C has different semantics wrt. overflow...

> > Have you looked at psyco?
> 
> Yes, very impressive once it does what it promises. 

I'm not sure what promises you mean, but it gets a 4x speedup on
pystone today.

> It is more ambitious than what I had in mind in that it does not use
> any assistance (type information) from the programmer.

Yes.

> > Well, there was boundless (it made me exceed my quota on the mail
> > server I was using ot the time) discussion on the types-sig on
> > more-or-less this sort of topic a couple of years back, although
> > perhaps more of the focus was on guaranteeing correctness than
> > optimization.  You could read that, but you don't want to.
> 
> Yes, I remember. 

Ah.

> I did not quite buy the correctness argument, runtime checking is
> fine with me, but for a compiler it might be very useful, IMO.

I was more interested in the optimization too..

> > It's possible, perhaps even desirable, that psyco could be extended in
> > this fashion.  Got a spare man-month or so?  I haven't.
> 
> No, neither have I, sorry. :-( Maybe later.

Indeedy.  Maybe after 2.2.1 is done...

Cheers,
M.



More information about the Python-list mailing list