[Python-ideas] Why CPython is still behind in performance for some widely used patterns ?
stefan_ml at behnel.de
Mon Feb 19 14:15:27 EST 2018
Nick Coghlan schrieb am 02.02.2018 um 06:47:
> to make the various extension module authoring tools
> easier to discover, rather than having folks assuming that handcrafted
> calls directly into the CPython C API is their only option.
Or even a competitive option. Tools like Cython or pybind11 go to great
length to shave off every bit of overhead from C-API calls, commonly
replacing high-level C-API functionality with macros and direct access to
data structures. The C/C++ code that they generate is so complex and tuned
that it would be infeasible to write and maintain something like that by
hand, but it can perfectly be generated, and it usually performs visibly
better than most hand-written modules, definitely much better than anything
a non-expert could write.
Basically, by not learning the C-API you can benefit from all that highly
tuned and specialised code written by C-API experts that the documentation
doesn't even tell you about.
More information about the Python-ideas