[Python-Dev] very bad network performance

Curt Hagenlocher curt at hagenlocher.org
Tue Apr 15 00:19:35 CEST 2008


On Mon, Apr 14, 2008 at 2:29 PM, Ralf Schmitt <schmir at gmail.com> wrote:
>
> Sorry to reply on the mailing list. But this change is wrong.
> e.g. if you're using a buffer size of 16 bytes and try to read 256 bytes, it
> should call recv with a value of 256 and not call recv 16 times with a value
> of 16.
> However, there should be an upper limit (as shown by the imap bug).

There is an upper limit.  It's called "the buffer size".  If someone
specifies a buffer size of 16 bytes, it means "read 16 bytes at a
time".  I don't know why someone would want such a small buffer size,
but presumably they have their reasons.

The only reason "min" is a problem is that there's standard library
code passing a zero to socket.makefile, which gets turned into a
bufsize of 1 by the constructor.  I actually agree with Bill Janssen
-- __init__ is where the real problem lies.  But I think the change to
read() is safer.

--
Curt Hagenlocher
curt at hagenlocher.org


More information about the Python-Dev mailing list