[pypy-dev] RPython question about the lifetime of global state

Armin Rigo arigo at tunes.org
Thu Mar 6 07:55:22 CET 2014

Hi Lenard,

On 6 March 2014 07:16, Lenard Lindstrom <len-l at telus.net> wrote:
> The prototype is written in RPython as an interpreter for executing
> array copies. The JIT comes automatically from the RPython tool chain, of
> course.

Cool :-)

RPython can certainly be used in this way, although critics might
rightfully argue that you're getting a very big framework around a
very small piece of code.  You're getting for free a JIT that knows
all about optimizing temporary allocations and tons of other things
typical in a dynamic language, none of which really applies in your
case.  As long as the interpreter to JIT is only of a few lines of
source, I'd recommend to at least have a look at other
libraries (LibJIT for example).  It would come with a smaller
footprint (in code size, in memory usage, and in warm-up time) for
similar results.  It only works if the interpreter to JIT is small or
if you have tons of time on your hand :-)

> So I wish to confirm that the lifetime of an RPython
> global namespace, the JIT caches, and the garbage collector are that of the
> loaded library, and not just that of an entry point function call.

Yes: it must be initialized only once, and then everything stays around.

A bientôt,


More information about the pypy-dev mailing list