<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace"><span style="font-family:arial,sans-serif">On Thu, Nov 2, 2017 at 1:41 PM, Antoine Pitrou </span><span dir="ltr" style="font-family:arial,sans-serif"><<a href="mailto:solipsis@pitrou.net" target="_blank">solipsis@pitrou.net</a>></span><span style="font-family:arial,sans-serif"> wrote:</span><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Thu, 2 Nov 2017 13:27:17 +0200<br>
Koos Zevenhoven <<a href="mailto:k7hoven@gmail.com">k7hoven@gmail.com</a>> wrote:<br>
> ​There's a limit to how cheap the call to PyErr_CheckSignals() can be. As I<br>
> mentioned earlier, even just the fact that it's a C function call​ can be<br>
> too much.<br>
><br>
> That's why, in the above, I used a new name PyErr_PROBE_SIGNALS() instead<br>
> of optimizing the existing PyErr_CheckSignals() –– turning<br>
> PyErr_CheckSignals() into a static inline function would change the ABI. I<br>
> also didn't call it PyErr_CHECK_SIGNALS() because the functionality is not<br>
> strictly equivalent to the existing function.<br>
<br>
</span>Please.  If you want to replace PyErr_CheckSignals() with something<br>
faster, the first thing to do is to prove that PyErr_CheckSignals()<br>
*is* too expensive.<br></blockquote><div><br></div><div class="gmail_default" style="font-family:monospace,monospace">I believe Serhiy proved that by showing that his first patch did not have negligible overhead for all cases. One might also write a C-implemented fibonacci calculator or similar to prove the overhead is significant.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">While I agree that there's a hint of premature optimization involved, my justification for it is that I want people to be confident that when they add the check, it's not going to slow down the loop significantly. Maybe the fear of overhead is one of reasons for people to write uninterruptible code. IMO, it should be made as easy as possible for the C programmer.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">––Koos</div><div class="gmail_default" style="font-family:monospace,monospace">​</div></div><div><br></div>-- <br><div class="gmail_signature">+ Koos Zevenhoven + <a href="http://twitter.com/k7hoven" target="_blank">http://twitter.com/k7hoven</a> +</div>
</div></div>