[pypy-dev] Question about extension support

Armin Rigo arigo at tunes.org
Fri Mar 28 08:59:12 CET 2014


Hi all,

I'd like to point Kevin to the thread "cpyext performance" of
July-August 2012, in which we did some explanation of what is slow
about cpyext and could potentially be improved.  As others have
mentioned here again, we can't reasonably hope to get them to the same
speed as on CPython, but "someone" could at least work and lower the
difference.  (Nobody did so far.)

https://mail.python.org/pipermail/pypy-dev/2012-July/010263.html

A small note about PyList_SET_ITEM(): this is impossible to keep as a
macro or even to write as C code.  There are some practical reasons as
mentioned here, but the most fundamental reason imho is that doing so
means throwing the flexibility of PyPy out of the window.  I'm talking
here about adding new implementations of list objects (we already have
several ones, e.g. for lists-of-integers or for range()), about
changing the GC, and so on.  In other words: of course it is possible
(if hard) to write the complete logic of PyList_SET_ITEM as C code,
and even as a C macro.  The point is that if we did that, then we'd
give up on the possibility of ever changing any of these other
aspects, or at least require painful adaptation every time we want to
change them.  (And yes, we do change them from time to time.  For
example, the STM branch we're working on has a different GC, and we
had to look inside cpyext exactly zero times to make it work.)


A bientôt,

Armin.


More information about the pypy-dev mailing list