[PATCH] revset: don't create changectx when matching for files

Durham Goode durham at fb.com
Tue Mar 17 12:51:22 CDT 2015


A more detailed breakdown of the profiling is here: 
https://bpaste.net/show/1affea0af5e4

It looks like repoview introduces some overhead (simply switching to an 
unfiltered repo gets us from 12s to 9.9s, despite this repo not having 
any obsolescence) and the remaining time is in the changectx constructor.

What are you running on the mozilla repo?  I'm doing 'time hg log 
editor/ -l 600 > /dev/null' which traverse about 100k commits:

Without my change:
~/local/mozilla-central> time hg log editor -l 600 > /dev/null
real    0m12.584s
user    0m12.451s
sys     0m0.131s

With my change:
~/local/mozilla-central> time hg log editor -l 600 > /dev/null
real    0m8.297s
user    0m8.180s
sys     0m0.115s

On 3/17/15 10:26 AM, Matt Mackall wrote:
> On Tue, 2015-03-17 at 09:57 -0700, Durham Goode wrote:
>> # HG changeset patch
>> # User Durham Goode <durham at fb.com>
>> # Date 1426610443 25200
>> #      Tue Mar 17 09:40:43 2015 -0700
>> # Node ID 5d4d0a97ccd85132bb5b1a640543cd24350b36c8
>> # Parent  567ae53657544744155897ada91f16f8af61ad8a
>> revset: don't create changectx when matching for files
>>
>> When running 'hg log some/dir/' on a large repo about 25% of the time was spent
>> just creating changectxs to call ctx.files() on.
> Can't repro. I get this profile on mozilla-central:
>
>    %   cumulative      self
>   time    seconds   seconds  name
>   16.78      2.62      2.62  revlog.py:90:decompress
>    3.85      0.60      0.60  match.py:108:__call__
>    2.72      0.42      0.42  utf_8.py:16:decode
>    2.67      0.71      0.42  changelog.py:212:node
>    2.41      0.38      0.38  revlog.py:78:hash
>    2.00      0.31      0.31  changelog.py:322:read
>    1.74      0.46      0.27  changelog.py:142:tip
>    1.69      0.26      0.26  revlog.py:1091:revision
>    1.69      0.26      0.26  utf_8.py:15:decode
>    1.69      0.26      0.26  revlog.py:350:start
>    1.69      0.26      0.26  revlog.py:282:__len__
>    1.49     11.00      0.23  context.py:485:_changeset
>    1.44      0.22      0.22  revlog.py:283:__len__
>    1.39      0.22      0.22  revlog.py:340:node
>    1.39      0.22      0.22  match.py:107:__call__
>    1.28      0.20      0.20  changelog.py:331:read
>    1.28      0.39      0.20  localrepo.py:30:__get__
>    1.23      0.72      0.19  changelog.py:144:tip
>    1.23      2.90      0.19  revlog.py:1007:_chunks
>    1.13     14.30      0.18  revset.py:1074:matches
>    1.08      0.98      0.17  revset.py:1075:matches
>    0.97      0.15      0.15  revlog.py:318:rev
>    0.97      0.15      0.15  revlog.py:940:_loadchunk
>    0.97      2.03      0.15  context.py:374:__init__
>    0.92      0.65      0.14  changelog.py:321:read
>    0.92      0.14      0.14  revlog.py:79:hash
>    0.92      0.14      0.14  revlog.py:70:hash
>
>> Let's just skip that part.
> I'd really like to see an analysis of why this crucial code path
> (creating context objects) is slow before simply patching around it in
> one of the thousand spots it's used.
>



More information about the Mercurial-devel mailing list