[PATCH 2 of 4] parsers: write dirstate starting with non-normal entries

Durham Goode durham at fb.com
Mon Nov 30 16:48:43 CST 2015



On 11/30/15 5:16 PM, Laurent Charignon wrote:
>> On Nov 25, 2015, at 12:27 PM, Durham Goode <durham at fb.com> wrote:
>>
>>
>>
>> On 11/24/15 8:19 PM, Laurent Charignon wrote:
>>> # HG changeset patch
>>> # User Laurent Charignon <lcharignon at fb.com>
>>> # Date 1448413597 28800
>>> #      Tue Nov 24 17:06:37 2015 -0800
>>> # Node ID ea9d03d4e85ea3949bb8d16bd9e1a80246a8247b
>>> # Parent  3bd86861a1618aabe6ec7f2cde1223282f9569be
>>> parsers: write dirstate starting with non-normal entries
>>>
>>> Before this patch we were writing the dirstate entries in a "random" way,
>>> following the *unstable* order of a Python dictionary. This patch changes the
>>> order in which we write the dirstate entries.
>>>
>>> We now start with the non-normal files (that have changed and likely to have
>>> changed) and end with the normal files. This makes the job of hg status easier
>>> as, in most cases, it will need to access the non-normal entries of the
>>> dirstate. This new ordering allows hg status to stop iterating over the dirstate
>>> after processing those entries.
>>>
>>> On our large repos, for hg status, we achieve a 40% improvement.
>>> On the same repo, the cost of this change is a slowdown for writing the
>>> dirstate to disk (as we do two passes). I measured the execution time of
>>> hg debugrebuilddirstate with and without the change and observed a 5% slowdown
>>> for the overall command.
>>>
>> Is 'hg debugrebuilddirstate' a good benchmark?  What is the performance difference for 'hg commit' or 'hg up .^'.  Also, what is the actual number behind 5%?  a 500ms slow down would be worriesome, while a 20ms slow down is ok.
>
> What else do you suggest to use?
> With hg debugrebuilddirstate, on one of our big repos, on average I measure a 16ms difference: 3.2s execution without the patch vs 3.32s with the patch.
>
Cool, that sounds minimal enough.  I just wasn't sure if hg 
debugrebuilddirstate executed the code in the same way commit or update 
would, since it sets all the bits to lookup.


More information about the Mercurial-devel mailing list