Bazaar: Out of memory
Ian Clatworthy
ian.clatworthy at internode.on.net
Sat May 10 01:17:45 BST 2008
Andrew Bennetts wrote:
> 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?
It's doable in fast-import. Not sure about knit.py though.
Ian C.
More information about the bazaar
mailing list