markshannon / New-C-API-for-Python

Design and discussion for the new C-API for Python
Creative Commons Zero v1.0 Universal
15 stars 1 forks source link

Add table describing portability vs performance. #12

Open markshannon opened 2 years ago

markshannon commented 2 years ago

Portability has two dimensions, versions and implementations.

E.g. If an extension is compiled to portable across versions and implementation, how does that compare to one compiled to be portable across versions but not implementations?

timfel commented 2 years ago

We have a few results relevant to this at the bottom of the page here, although maybe a bit hard to interpret: https://github.com/hpyproject/hpy/wiki/dev-call-20220407

The gist is that HPy extensions compiled against the universal API (portable across Python implementations) is a bit slower (up to ~5% in microbenchmarks, less so in larger ones) than the one compiled against the HPy CPython ABI backend (which targets the CPython ABI). The latter is indistinguishable in performance from the original matplotlib and kiwisolver implementations. (That is even though INCREF/DECREF are no longer macros and the object structures are not exposed - inline function calls seem to work just as well)