[MERGE] A hack to make urllib not call recv(1) lots and lots.

Robert Collins robertc at robertcollins.net
Sun Mar 16 23:47:18 GMT 2008


On Sun, 2008-03-16 at 14:56 -0500, Andrew Bennetts wrote:
> Pavel Pergamenshchik at PyCon noticed that "bzr branch http://..." on a large
> branch was using lots of CPU, and strace showed that it was making a huge number
> of recv(1) calls to read bytes off the socket one byte at a time.  It seems this
> is caused because httplib's HTTPResponse doesn't specify a buffer size for the
> fileobject it constructs from its socket, and it doesn't provide a way to
> override this.
> 
> This patch is a hack to fix this.  It's a bit dirty, but it massively reduces
> the number of recv calls bzr makes with urllib.

bb:tweak

For modern OS's, 64K is much more reasonable a network buffer size.
Secondly, I second John's concerns about windows; I suggest that a
windows use might like to test this before it lands if thats ok.

-Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080317/f262160e/attachment.pgp 


More information about the bazaar mailing list