<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I think both PEPs are relying on FASTCALL calling convention,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">and can't be accepted until FASTCALL is stable & public.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">There are enough time before Python 3.8 is released.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Let's go step by step.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Regards,</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 4, 2018 at 12:10 AM Jeroen Demeyer <<a href="mailto:J.Demeyer@ugent.be">J.Demeyer@ugent.be</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,<br>
<br>
in order to make reviewing PEP 576/580 easier and possibly take some <br>
ideas from one PEP to the other, let me state the one fundamental <br>
difference between these PEPs. There are many details in both PEPs that <br>
can still change, so I'm focusing on what I think is the big structural <br>
difference.<br>
<br>
To be clear: I'm referring to the PEP 576 version at<br>
<a href="https://github.com/markshannon/pep-576/blob/master/README.rst" rel="noreferrer" target="_blank">https://github.com/markshannon/pep-576/blob/master/README.rst</a><br>
(this really should be merged in the main PEP repo).<br>
<br>
Both PEPs add a hook for fast calling of C functions. However, they do <br>
that on a different level. Let's trace what _PyObject_FastCallKeywords() <br>
currently does when acting on an instance of builtin_function_or_method:<br>
<br>
A. _PyObject_FastCallKeywords()<br>
      calls<br>
B. _PyCFunction_FastCallKeywords()<br>
      which calls<br>
C. _PyMethodDef_RawFastCallKeywords()<br>
      which calls<br>
D. the actual C function (*ml_meth)()<br>
<br>
PEP 576 hooks the call A->B while PEP 580 hooks the call B->D (getting <br>
rid of C).<br>
<br>
Advantages of the high-level hook (PEP 576):<br>
* Much simpler protocol than PEP 580.<br>
* More general since B can be anything.<br>
* Not being forced to deal with "self".<br>
* Slightly faster when you don't care about B.<br>
<br>
Advantages of the low-level hook (PEP 580):<br>
* No need to duplicate the code from B (see the various existing <br>
_{FOO}_FastCallKeywords functions).<br>
* Enables certain optimizations because other code can make assumptions <br>
about what B does.<br>
<br>
In my personal opinion, the last advantage of PEP 580 is really <br>
important: some existing optimizations depend on it and it also allows <br>
extending the protocol in a "performance-compatible" way: it's easy to <br>
extend the protocol in a way that callers can benefit from it.<br>
<br>
Anyway, it would be good to have some guidance on how to proceed here. I <br>
would really like something like PEP 580 to be accepted and I'm willing <br>
to put time and effort into achieving that.<br>
<br>
<br>
Thanks,<br>
Jeroen.<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/songofacandy%40gmail.com" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/songofacandy%40gmail.com</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">INADA Naoki  <<a href="mailto:songofacandy@gmail.com" target="_blank">songofacandy@gmail.com</a>></div>