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

Andrew Bennetts andrew at canonical.com
Sun Mar 16 19:56:58 GMT 2008


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.

-Andrew.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: urllib-recv-1-hack-3288.patch
Type: text/x-diff
Size: 3768 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080316/6a242995/attachment.bin 


More information about the bazaar mailing list