[pypy-dev] cpyext performance

Armin Rigo arigo at tunes.org
Thu Aug 30 09:10:03 CEST 2012


Hi Stefan,

On Wed, Aug 29, 2012 at 10:29 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
>> Ok, so where would this have to be done? Is there a way to implement it
>> generically in that ubiquitous space.wrap() kind of call (whatever that
>> does internally), or would it have to be done explicitly whenever objects
>> pass the boundary?
>
> Any comments? I think this would solve a lot of problems.

You need to do it at the level of the boundary --- space.wrap() is at
a different level.  We can't slow it down by doing dictionary lookups
there, because it would be a big hit of performance for the whole
PyPy.

Fwiw I'm now thinking about a possible rewrite of cpyext, based on (an
extension of) CFFI that would let us declare a C API and implement it
in Python.  This would mean basically moving cpyext to a regular
app-level module.  Doing so in general would be useful to write C
extensions or wrappers for existing libraries: they would not
necessarily be using the CPython C API but instead any custom C API
that is most suitable for that particular extension.  For Cython, it
would mean that you would be free to invent whatever API is most
suitable --- starting, I'm sure, with some subset of the CPython C
API, but possibly evolving over time towards something that offers
better performance in the context of PyPy.


A bientôt,

Armin.


More information about the pypy-dev mailing list