[pypy-dev] Question about extension support

Sarah Mount mount.sarah at gmail.com
Fri Mar 28 11:08:18 CET 2014


Hi all,


On Fri, Mar 28, 2014 at 8:51 AM, Armin Rigo <arigo at tunes.org> wrote:

> Hi Laura,
>
> On 26 March 2014 23:29, Laura Creighton <lac at openend.se> wrote:
> > really, really hideously slow.  You are sometimes _way_
> > better off writing python code instead -- pypy with the jit turned off
> > outperforms CPython purely on the benefits of not doing ref-counting, and
> > pypy really needs the jit to  be fast.
>
> That detail is wrong.  PyPy with the JIT turned off is 1.5x to 2x
> slower than CPython.  (The reason is just the higher level of RPython
> versus hand-optimized C.)
>
> It is a common misconception to blame reference counting for the
> general slowness of standard interpreters of Python-like languages;
> I've seen it a few times in various contexts.  But it's wrong: manual
> reference counting as in CPython doesn't cost much.  This is probably
> because the reference counting increment/decrement end up as a very
> small fraction of the total runtime in this case.  Also, the malloc()
> implementation used probably helps (it is very close to the one for
> the standard malloc() on Linux, which is really efficient for a lot of
> usage patterns).
>
> On the other hand, the reason PyPy doesn't include refcounting is that
> it's not reasonable at the level of the RPython implementation.  Our
> RPython code assumes a GC *all the time*, e.g. when dealing with
> internal lists; by contrast, the CPython implementation assumes no GC
> and tries hard to put everything as stack objects, only occasionally
> "giving up" and using a malloc, like it is common in C.  So
> incref/decref "everywhere in PyPy" means at many, many more places
> than "everywhere in CPython".  In PyPy it is enough to kill
> performance completely (as we measured a long time ago).
>
>

This is a really interesting discussion, thanks for spelling it out the
details so clearly. Did the measurements you refer to get published
anywhere?

Thanks,

Sarah

-- 
Sarah Mount, Senior Lecturer, University of Wolverhampton
website:  http://www.snim2.org/
twitter: @snim2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20140328/d4639048/attachment.html>


More information about the pypy-dev mailing list