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

2011-01-09 Thread max ulidtko
On Wed, 20 Mar 2002 14:53:58 -0500, Andrew Kuchling wrote: | sendfile() is used when writing really high-performance Web servers, | in order to save an unnecessary memory-to-memory copy. Question: | should I make up a patch to add a sendfile() wrapper to Python? So, was this proposal rejected?

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

2011-01-09 Thread Antoine Pitrou
On Sat, 08 Jan 2011 09:55:19 +0200 max ulidtko ulid...@gmail.com wrote: On Wed, 20 Mar 2002 14:53:58 -0500, Andrew Kuchling wrote: | sendfile() is used when writing really high-performance Web servers, | in order to save an unnecessary memory-to-memory copy. Question: | should I make up a

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

2011-01-09 Thread Guido van Rossum
Isn't that just shutil.copyfileobj()? On Fri, Jan 7, 2011 at 11:55 PM, max ulidtko ulid...@gmail.com wrote: On Wed, 20 Mar 2002 14:53:58 -0500, Andrew Kuchling wrote: | sendfile() is used when writing really high-performance Web servers, | in order to save an unnecessary memory-to-memory copy.

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

2011-01-09 Thread Giampaolo Rodolà
A strong +1. Projects such as Twisted would certainly benefit from such an addiction. I'm not sure the os module is the right place for sendfile() to land though. Implementation between different platforms tends to vary quite a bit. A good resource is the samba source code which contains an

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

2011-01-09 Thread Antoine Pitrou
On Sun, 9 Jan 2011 11:17:40 -0800 Guido van Rossum gu...@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

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

2011-01-09 Thread Martin v. Löwis
Am 09.01.2011 21:31, schrieb Antoine Pitrou: On Sun, 9 Jan 2011 11:17:40 -0800 Guido van Rossum gu...@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

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

2011-01-09 Thread James Y Knight
If you're gonna wrap sendfile, it might be nice to also wrap the splice, tee, and vmsplice syscalls on linux, since they're a lot more flexible. Also note that sendfile on BSD has a completely different signature to sendfile on linux. The BSD one has the rather odd functionality of a built-in

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

2011-01-09 Thread max ulidtko
On Sun, 9 Jan 2011 11:17:40 -0800, Guido van Rossum wrote: | Isn't that just shutil.copyfileobj()? | This function has two drawbacks. First, it copies until EOF, and has no possibility to copy exactly N bytes from source fd (say, opened socket). This is the reason why I (re)wrote my custom

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

2011-01-09 Thread exarkun
On 9 Jan, 08:09 pm, g.rod...@gmail.com wrote: A strong +1. Projects such as Twisted would certainly benefit from such an addiction. Eh. There would probably be some benefits, but I don't think they would be very large in the majority of cases. Also, since adding it to 2.x would be

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

2011-01-09 Thread Terry Reedy
On 1/8/2011 2:55 AM, max ulidtko wrote: On Wed, 20 Mar 2002 14:53:58 -0500, Andrew Kuchling wrote: | sendfile() is used when writing really high-performance Web servers, | in order to save an unnecessary memory-to-memory copy. Question: | should I make up a patch to add a sendfile() wrapper to