Bazaar: Out of memory
Andrew Bennetts
andrew at canonical.com
Sat May 10 00:58:37 BST 2008
James Henstridge wrote:
[...]
>
> In contrast, each "line_bytes += line" iteration in your version does:
> 1. allocate a new string large of length len(line_bytes) + len(line)
> 2. copy line_bytes and line into the new string
> 3. free the old line_bytes.
(Actually, since Python 2.4, “s += 'abc'” is sometimes more efficient:
http://python.org/doc/2.4.2/whatsnew/node12.html#SECTION0001210000000000000000
It doesn't sound like you should rely on that particular optimisation though.)
I haven't looked at the offending code at all, but how hard would it be for the
relevant APIs to accept an iterable of strings instead of a single big string?
-Andrew.
More information about the bazaar
mailing list