[Python-ideas] Why CPython is still behind in performance for some widely used patterns ?

Nick Coghlan ncoghlan at gmail.com
Tue Feb 20 08:12:15 EST 2018


On 20 February 2018 at 16:17, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Mon, 19 Feb 2018 20:15:27 +0100
> Stefan Behnel <stefan_ml at behnel.de> wrote:
>> 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.
>
> Doesn't the documentation ever mention Cython? It probably should (no
> idea about pybind11, which I've never played with). Perhaps you can
> open an issue about that?

We mention them in the Extending & Embedding guide, and link out to
the page on packaging.python.org that describes them in more detail:
https://docs.python.org/3/extending/index.html#recommended-third-party-tools

Cheers,
Nick.

P.S. There are also a number of open issues at
https://github.com/pypa/python-packaging-user-guide/issues regarding
additional projects that should be mentioned in
https://packaging.python.org/guides/packaging-binary-extensions/

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list