[pypy-dev] Slow int code

Armin Rigo arigo at tunes.org
Fri Mar 1 11:34:14 CET 2013


Hi Roger,

On Thu, Feb 28, 2013 at 6:00 PM, Roger Flores <aidembb at yahoo.com> wrote:
> OK then. Unzip it, grab a text file large enough to warm up the jit, and run
> the line to generate the log for jitviewer.

I think there is nothing quite broken for PyPy.  It just has a very
long warm-up time.  On my 64-bit laptop, it runs frank.txt in 14+10
seconds.  If I replace frank.txt by 5 concatenated copies of it, it
takes 34+29 seconds.  That means every additional run takes only 5
seconds.  For comparison the CPython time, also on 64-bit, is 21+21
seconds for frank.txt.  It's not very clear why, but the warm-up time
can be much smaller or bigger depending on the example; it's some
current and future research to improve on that aspect.

On 32-bit there is extra time needed --- both on PyPy and on CPython
--- because the numbers you use overflow signed 32-bit ints, and it
needs longs.  On PyPy we could in theory improve for that case, e.g.
by writing an alternate implementation for longs, for example for
numbers that fit into two regular-sized integers.  (There is actually
one implementation for that, but it's not complete and limited so far,
so not enabled by default; see pypy.objspace.std.smalllongobject.py.
A more complete version would really use two integers, rather than a
"long long" integer.)


A bientôt,

Armin.


More information about the pypy-dev mailing list