[PATCH] commit: increase perf by building a new addlist instead of editing the old one

Durham Goode durham at fb.com
Wed Nov 28 18:03:18 CST 2012


Just fyi, I did some basic research into various ways of string building
in python.

In the past, join was fastest (python 2.2:
http://www.skymind.com/~ocrow/python_string/), but in more recent versions
of python it seems straight up string concatenation is just as fast
(python 2.7: 
http://stackoverflow.com/questions/2414667/python-string-class-like-stringb
uilder-in-c-sharp).


On 11/28/12 3:50 PM, "Matt Mackall" <mpm at selenic.com> wrote:

>On Mon, 2012-11-19 at 16:06 -0800, Durham Goode wrote:
>> # HG changeset patch
>> # User Durham Goode <durham at fb.com>
>> # Date 1353369940 28800
>> # Node ID dc8825eb30952ef7a57de221f2e7b30ec94c25df
>> # Parent  d9b947bf66c06bd2e0090b984295f2e0e077deb5
>> commit: increase perf by building a new addlist instead of editing the
>>old one
>
>Looks good, queued for default.
>
>I'm a little worried that this might have some O(n²) behavior lurking
>due to resizing (just like the original version). One wonders if this
>might be better if you gather a list of fragments and join them.
>
>-- 
>Mathematics is the supreme nostalgia of our time.
>
>



More information about the Mercurial-devel mailing list