[pypy-dev] I was talking with Russel Winder at PyCON UK.

Armin Rigo arigo at tunes.org
Fri Sep 30 18:52:35 CEST 2011


Hi,

On Fri, Sep 30, 2011 at 17:54, Josh Ayers <josh.ayers at gmail.com> wrote:
> I don't think it's due to the warmup of the JIT.  Here's a simpler example.

I think that your example is perfectly compatible with the JIT warmup
time theory.  This is kind of obvious by comparing the CPython and the
PyPy timings:

- something that takes less than 1ms on CPython is going to be just as
fast on PyPy (or at least, less than 2ms) because there is no JITting
at all involved;

- something that runs several seconds *in the same process* in CPython
would be likely to be faster on PyPy;

- everything shorter is at risk: I'd say that 0.1 to 0.5 seconds in
CPython looks like the worst case for PyPy, because it needs to run
the JIT but the process terminates before it's really useful.  That's
just what your example shows.

On non-Windows I would recommend to prime the JIT my calling a few
times the function, in so that a fork() can inherit already-JITted
code.  Of course it doesn't work on Windows.  You're left with the
usual remark: PyPy's JIT does have a long warm-up time for every
process that is started anew, so make sure to use the multiprocessing
module carefully (e.g. don't stop and restart processes all the time).


A bientôt,

Armin.


More information about the pypy-dev mailing list