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

SuperMMX supermmx at gmail.com
Mon Mar 17 03:13:04 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, Andrew Bennetts <andrew at canonical.com> :

On Sun, 16 Mar 2008 14:56:58 -0500
Andrew Bennetts <andrew at canonical.com> 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.

Here is the rough number on Windows, without the patch, the CPU usage is
about 45%, but with the patch, the CPU usage never exceed 10%

Any way to get the precise number ?

- -- 
A. Because it makes the logic of the discussion difficult to follow.
Q. Why shoudn't I top post?
A. No.
Q Should I top post?

A: Because it destroys the flow of the conversation
Q: Why is it bad?
A: No, it's bad.
Q: Should I top post in replies to mailing lists? 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)

iEYEARECAAYFAkfd4cAACgkQYjhzyV/TMxtw4QCggwhzfxkpnvVpK1RAU9D+OjJh
q2oAn1IICTFNCOrKPk7Z3EMcHo+2fiP6
=VMWJ
-----END PGP SIGNATURE-----



More information about the bazaar mailing list