[Python-Dev] Micro-benchmarks for PEP 580

INADA Naoki songofacandy at gmail.com
Tue Jul 10 20:12:11 EDT 2018


On Tue, Jul 10, 2018 at 10:20 PM Antoine Pitrou <solipsis at pitrou.net> wrote:
>
> 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.

This is just an example of possible optimization, to explain why I want
example application first.
I know Cython is important for data scientists.  But I don't know how
it used typically.

If my idea has 50% gain and current PEP 580 has only 5% gain,
why we should accept PEP 580?
But no one know real gain, because there are no realistic application
which bottleneck is calling overhead.

Without example application, I can't consider PEP 580 seriously.
Microbenchemarks doesn't attract me.
And PEP 576 seems much simpler and straightforward way to expose
FASTCALL.


>
> > 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.

Why not allow it for extensions written in C, without Cython?

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

Really?  If so, I prefer PEP 576 to PEP 580.  PEP 580 is too complicated.

Anyway, I want more example applications which uses Cython heavily
for further discussion.

Regards,
-- 
INADA Naoki  <songofacandy at gmail.com>


More information about the Python-Dev mailing list