<div dir="ltr">accept4() was added for atomicity (O_CLOEXEC), not performance.<div>For pipe2() vs pipe(), this could make a measurable difference because the base syscall is so fast, but for accept(), which is a blocking syscall, shaving one or two syscalls are unlikely to yield any performance gain.</div>
<div><br></div><div>IMO that's not a reason good enough to make accept() signature more complex.</div><div><br></div><div>cf</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-07 11:14 GMT+00:00 Saúl Ibarra Corretgé <span dir="ltr"><<a href="mailto:saghul@gmail.com" target="_blank">saghul@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 03/07/2014 11:40 AM, Antoine Pitrou wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, 07 Mar 2014 10:37:58 +0100<br>
Saúl Ibarra Corretgé <<a href="mailto:saghul-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" target="_blank">saghul-<u></u>Re5JQEeQqe8AvxtiuMwx3w@public.<u></u>gmane.org</a>><br>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
accept4 allows us to do this with a single syscall, and it made it into<br>
FreeBSD 10, so that's another system that could benefit from this<br>
optimization.<br>
</blockquote>
<br>
If it doesn't, then perhaps the configure script needs to be fixed.<br>
<br>
</blockquote>
<br></div>
Probably not, I'll have a look.<div class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The idea is to accept an incoming connection and make it non-blocking at<br>
the same time, asyncio and other frameworks would benefit from this by<br>
doing one function call and 2 syscalls less (on supported systems, that is).<br>
</blockquote>
<br>
That's not likely to do a significant difference (benchmarks welcome).<br>
<br>
</blockquote>
<br></div>
Actually, after <a href="http://hg.python.org/cpython/rev/5f0d1aad7322/" target="_blank">http://hg.python.org/cpython/<u></u>rev/5f0d1aad7322/</a> it's 2 function calls (accept + set_blocking)+ 2 syscalls (accept + ioctl FIONBIO) vs 1 function call (accept) + 1 syscall (accept4).<div class="im HOEnZb">
<br>
<br>
-- <br>
Saúl Ibarra Corretgé<br>
<a href="http://bettercallsaghul.com" target="_blank">bettercallsaghul.com</a><br></div><div class="HOEnZb"><div class="h5">
______________________________<u></u>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/<u></u>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/<u></u>codeofconduct/</a></div></div></blockquote></div><br></div>