what's the point of rpython?

Luis M. González luismgz at gmail.com
Fri Jan 16 19:58:30 EST 2009


On Jan 16, 9:37 pm, "Brendan Miller" <catph... at catphive.net> wrote:
> So I kind of wanted to ask this question on the pypy mailing list..
> but there's only a pypy-dev list, and I don't want to put noise on the
> dev list.
>
> What's the point of RPython? By this, I don't mean "What is RPython"?
> I get that. I mean, why?
>
> The goals of the pypy project seems to be to create a fast python
> implementation. I may be wrong about this, as the goals seem a little
> amorphous if you look at their home page.
>
> So, to do that this RPython compiler was created? Except that it
> doesn't compile python, it compiles a static subset of python that has
> type inference like ML.
>
> This RPython thing seems like a totally unnecessary intermediate step.
> Instead of writing an implementation of one language, there's an
> implementation of two languages.
>
> Actually, it seems like it harms the ultimate goal. For the
> interpreted pyton to be fast, the interpreter has to be written in a
> reasonably fast language. ML, and C++ compilers have had a lot of work
> put into their optimization steps. A lot of the performance boost you
> get from a static language is that knowing the types at compile time
> lets you inline code like crazy, unroll loops, and even execute code
> at compile time.
>
> RPython is a statically typed language because I guess the developers
> associate static languages with speed? Except that they use it to
> generate C code, which throws away the type information they need to
> get the speed increase. Huh? I thought the goal was to write a fast
> dynamic language, not a slow static one?
>
> Is this going anywhere or is this just architecture astronautics?
>
> The RPython project seems kind of interseting to me and I'd like to
> see more python implementations, but looking at the project I can't
> help but think that they haven't really explained *why* they are doing
> the things they are doing.
>
> Anyway, I can tell this is the sort of question that some people will
> interpret as rude. Asking hard questions is never polite, but it is
> always necessary :)
>
> Thanks,
> Brendan

Check out this thread:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/1a8c866b4c4d7521/2174f796cd687931?lnk=gst&q=enlighten+pypy#2174f796cd687931

One of pypy's goals is having a more flexible implementation, easier
to experiment with than cpython.
Having all written in the same language facilitates this task.
Why Rpython? Because by avoiding the dinamicity of the whole python
language, it is possible to translate this code to a static one (c,
java, whatever).
The translated rpython interpreter aims to be something similar in
performance to cpython. The only difference is that cpython was
written from scratch in c, while pypy's interpreter was written in
rpython and then translated automatically to c.

The pypy team intends to achieve greater speed and performance by
adding a JIT compiler to this interpreter.
So pypy-c + JIT = faster python.

I hope this helps...

Luis





More information about the Python-list mailing list