[Python-Dev] Micro-benchmarks for PEP 580

Antoine Pitrou solipsis at pitrou.net
Tue Jul 10 09:20:21 EDT 2018


On Tue, 10 Jul 2018 21:59:28 +0900
INADA Naoki <songofacandy at gmail.com> wrote:
> 
> Then, the function is called from another C extension like this:
> 
> PyObject_CallFunction(func, "n", 42);
> 
> Currently, we create temporary long object for passing argument.
> If there is protocol for exposeing format used by PyArg_Parse*, we can
> bypass temporal Python object and call myfunc_impl directly.

This is another can of worms to open.  If you're worried about the
added complexity of PEP 580, what you're proposing is one or two orders
of magnitude more complicated.

> I think optimization like this idea can boost application performance
> using Cython heavily.

You can already define the C signature of a function in Cython and
intra-Cython calls will benefit from it where possible.  Cooperation
from core Python is not necessary for that.

The main point of PEP 580 is to make Cython functions faster when
called from pure Python, not from other Cython functions.

Regards

Antoine.




More information about the Python-Dev mailing list