7 Sep 2018 7 Sep '18
On 2018-09-07 14:47, Victor Stinner wrote:
Inside CPython, the core and builtin modules, micro-optimizations must be used: abuse borrowed references, macros, access directly to all fields of C structure, etc.
But here I'm talking about the public C API used by third party extensions.
Making a difference between "inside CPython" and "third party extensions" is a bad idea. Making such a difference would be problematic:
- Complexity: we should not have two different C APIs. There should be
just one, usable internally and externally.
- Performance: if an optimization is important for CPython, then it's
also important for third-party extensions. We don't want third-party code to be inherently slower than CPython itself. (this reminds me of PEP 580, regarding several internal optimizations which aren't available to third-party classes)