<div dir="ltr">IMNSHO the <i>time</i> is less relevant than the fact that it uses less memory by not repeatedly making copies.<div><br></div><div>In general we should use the more recent non-copying APIs when possible within the standard library but most of that code is pretty old and has not been look at for conversion.  Any such changes are welcome in 3.4+.</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 3, 2013 at 11:00 AM, Antoine Pitrou <span dir="ltr"><<a href="mailto:solipsis@pitrou.net" target="_blank">solipsis@pitrou.net</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sun, 3 Mar 2013 19:40:04 +0100<br>
Charles-François Natali<br>
<div class="im"><<a href="mailto:cf.natali@gmail.com">cf.natali@gmail.com</a>> wrote:<br>
><br>
> > sendfile() is a Linux-only syscall. It's also limited to certain kinds<br>
> > of file descriptors. The limitations have been lifted in recent kernel<br>
> > versions.<br>
><br>
> No, it's not Linux-only, many BSD also have it, although all don't<br>
> support an arbitrary output file descriptor (Solaris does allow<br>
> regular files too). It would be possible to catch EINVAL/EBADF, and<br>
> fall back to a regular copy loop.<br>
><br>
> Note that the above benchmark is really biased by writing the data to<br>
> /dev/null: with a real target file, the zero-copy wouldn't bring such<br>
> a large gain, because the bottleneck will really be the I/O devices<br>
> (also a read()/write() loop is more expensive in Python than in C).<br>
<br>
</div>Can you post your benchmark's code? I could time it on a SSD.<br>
<div class="im"><br>
> But I see at least two cases where it could be interesting: when<br>
> reading/writing from/to a tmpfs partition, or when the source and<br>
> target files are on different disks.<br>
<br>
</div>That's already nice.<br>
<br>
Regards<br>
<span class="HOEnZb"><font color="#888888"><br>
Antoine.<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br></div>