[Python-Dev] PEP 580/590 discussion

Jeroen Demeyer J.Demeyer at UGent.be
Wed Apr 3 01:43:28 EDT 2019


On 2019-04-02 21:38, Mark Shannon wrote:
> Hi,
>
> On 01/04/2019 6:31 am, Jeroen Demeyer wrote:
>> I added benchmarks for PEP 590:
>>
>> https://gist.github.com/jdemeyer/f0d63be8f30dc34cc989cd11d43df248
>
> Thanks. As expected for calls to C function for both PEPs and master
> perform about the same, as they are using almost the same calling
> convention under the hood.

While they are "about the same", in general PEP 580 is slightly faster 
than master and PEP 590. And PEP 590 actually has a minor slow-down for 
METH_VARARGS calls.

I think that this happens because PEP 580 has less levels of indirection 
than PEP 590. The vectorcall protocol (PEP 590) changes a slower level 
(tp_call) by a faster level (vectorcall), while PEP 580 just removes 
that level entirely: it calls the C function directly.

This shows that PEP 580 is really meant to have maximal performance in 
all cases, accidentally even making existing code faster.


Jeroen.


More information about the Python-Dev mailing list