Please enlighten me about PyPy

Ray ray_usenet at yahoo.com
Thu Dec 22 02:44:50 EST 2005


Hi Luis!

Thanks for your reply :) Some further questions below...

> So its author decided that having a python implementation written in
> python would laid a much better basis for implementing psyco-like
> techniques.

OK, so far I get it... I think. So it's implementing the Python
interpreter in a Python subset called RPython, makes it more amenable
to translation with psyco-like techniques. But how is this superior
compared to CPython? Is it because Psyco is a specializer, which
generate potentially different code for different sets of data? So the
assumption is that the interpreter deals with a very specific set of
data that Psyco will be able to make use to generate very efficient
machine code?

I still don't get how this can be superior to the hand-coded C version
though?

Also, this sounds like it involves implementing the Python's libraries
that are currently implemented in C, in Python, so that they can be
translated. Did I get that correctly?

> This implementation requires a minimal core, writen in a restricted
> subset of python called "rpython". This subset avoids many of the most
> dynamic aspects of python, making it easier to authomatically translate
> it to C through a tool that uses top-notch type inference techniques.

OK, now I understand this bit about RPython, thanks.

> This translated version of the rpython interpreter (which got already
> auto-translated to c), is the basis of Pypy.

Now I'm confused again--psyco translates Python into machine code--so
how does this tie in with the fact that the interpreter written in
Python is translated into another language (in this case C?)

> However, I still doubt that I really understood it...
> I'm still not sure if the type inference techniques will be used to
> improve the performance of programs running on pypy, or if these
> techniques were only intended for getting the rpython interpreter
> translated to c.
>
> As far as I know, pypy is currently about 10/20 times slower than
> cpython, although many optimizations remain to be done.
> And I 'm not sure, but I think that its developers rely on the
> psyco-like techniques to achieve the big speed boost their looking for.

This is another one I don't get--this approach seems to imply that when
PyPy is reasonably complete, it is expected that it'll be faster than
CPython. I mean, I don't get how something that's translated into C can
be faster than the handcoded C version?

Thanks,
Ray

> 
> Luis




More information about the Python-list mailing list