[PATCH 0 of 6 v2] speed up hg-add

Joshua Redstone joshua.redstone at fb.com
Mon Jul 2 10:59:41 CDT 2012


This is much trickier than I originally thought.
I'm going to extract from the patch series the simpler patches and resend
them on their own individually.
Josh

On 6/26/12 4:02 PM, "Matt Mackall" <mpm at selenic.com> wrote:

>On Tue, 2012-06-26 at 12:04 -0700, Joshua Redstone wrote:
>> This is a second pass at a patch series to speed up hg-add of a single
>>file on a
>> large repo from about 2.5 seconds down to 0.75 seconds.  It works by
>>introducing
>> a _sortedfiles property into dirstate and some lazy caching into the
>>case
>> collision checker.  After the optimization, it looks like about 30% of
>>time (say
>> 0.3 seconds) is spent copying dirstate._map and filtering out entries
>>of type
>> 'r'.  Sorting the resulting list is negligable in time, as is the log-n
>> searching the list and even the o(n) insertion to update the list
>>(probably
>> because the constant is so small?).
>
>FYI, the reason this tends to not be impossibly slow is probably that:
>
>a) Python lists are over-allocated when you grow them by some factor
>b) add gets a sorted list of files from status, so will generally insert
>at the end
>
>-- 
>Mathematics is the supreme nostalgia of our time.
>
>



More information about the Mercurial-devel mailing list