[Python-Dev] Add sendfile() to core?

"Martin v. Löwis" martin at v.loewis.de
Sun Jan 9 23:06:22 CET 2011

Am 09.01.2011 21:31, schrieb Antoine Pitrou:
> On Sun, 9 Jan 2011 11:17:40 -0800
> Guido van Rossum <guido at python.org> wrote:
>> Isn't that just shutil.copyfileobj()?
> copyfileobj() still uses an user-space buffer (the Python bytes
> object used in the loop).  The advantage of sendfile() is to bypass
> user-space logic and do the transfer entirely in kernel.  How much it
> allows to gain *in practice* on a modern capable OS such as Linux I
> don't know.

There would be at least two layers of savings:
a) no Python objects would be created, and no bytecode loop would
   run the copying
b) the data are not even copied into userspace at all

My guess is that the savings of doing a) are larger than the savings
of doing b).


More information about the Python-Dev mailing list