[Python-Dev] Let's change to C API!

Antoine Pitrou solipsis at pitrou.net
Sat Aug 11 09:19:40 EDT 2018


Hi Armin,

On Fri, 10 Aug 2018 19:15:11 +0200
Armin Rigo <armin.rigo at gmail.com> wrote:
> Currently, the C API only allows Psyco-style JITting (much slower than
> PyPy).  All three other points might not be possible at all without a
> seriously modified C API.  Why?  I have no proof, but only
> circumstantial evidence.  Each of (2), (3), (4) has been done in at
> least one other implementation: PyPy, Jython and IronPython.  Each of
> these implementation has also got its share of troubles with emulating
> the CPython C API.  You can continue to think that the C API has got
> nothing to do with it.  I tend to think the opposite.  The continued
> absence of major performance improvements for either CPython itself or
> for any alternative Python implementation that *does* support the C
> API natively is probably proof enough---I think that enough time has
> passed, by now, to make this argument.

Jython and IronPython never got significant manpower AFAIK, so even
without being hindered by the C API, chances are they would never have
gotten very far.  Both do not even seem to have stable releases
implementing the Python 3 language...

That leaves us with CPython and PyPy, which are only two data points.
And there are enough differences, AFAIK, between those two that picking
up "supports the C API natively" as the primary factor leading to a
performance difference sounds arbitrary.

(the major difference being IMHO that PyPy is written in RPython, which
opens up possibilities that are not realistic with a C implementation,
such as the JIT being automatically able to inspect implementations of
core / stdlib primitives; in a CPython-based JIT such as Numba, you
have to reimplement all those primitives in a form that's friendly to
the JIT compiler)

Regards

Antoine.


More information about the Python-Dev mailing list