Submitter | Mads Kiilerich |
---|---|
Date | Dec. 14, 2014, 6:34 p.m. |
Message ID | <a84099ef1a332eb93bc9.1418582063@ssl.google-analytics.com> |
Download | mbox | patch |
Permalink | /patch/7090/ |
State | Superseded |
Commit | 7d63398fbfd1b3f8693e46035c9058b6cfb824aa |
Headers | show |
Comments
On 12/14/2014 10:34 AM, Mads Kiilerich wrote: > # HG changeset patch > # User Mads Kiilerich <madski@unity3d.com> > # Date 1418581984 -3600 > # Sun Dec 14 19:33:04 2014 +0100 > # Node ID a84099ef1a332eb93bc9287d74c64af7e510f90e > # Parent eeeae034dc7aa8501c3e8f510a0788a77e54bc9f > branchmap: use revbranchcache when updating branch map > > This will speed repeated branchmap calculation up. > > perfbranchmap base on mozilla-central, before: > ! wall 6.995851 comb 6.990000 user 6.970000 sys 0.020000 (best of 3) > After: > ! wall 2.599774 comb 2.600000 user 2.600000 sys 0.000000 (best of 4) > > On the hg repo, before: > ! wall 0.718498 comb 0.720000 user 0.720000 sys 0.000000 (best of 14) > After: > ! wall 0.284678 comb 0.290000 user 0.290000 sys 0.000000 (best of 32) > > The use of revbranchcache for branch map will also make sure the revbranchcache > "always" is kept up-to-date. If the cache for some reason should be out of > sync, the wrong information in the cache will be skipped and the branch > information will be retrieved as normally and the cache entry will be updated. > > diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py > --- a/mercurial/branchmap.py > +++ b/mercurial/branchmap.py > @@ -234,13 +234,15 @@ > cl = repo.changelog > # collect new branch entries > newbranches = {} > - getbranchinfoutf8 = cl.branchinfoutf8 > + cache = revbranchcache(repo) > + getbranchinfoutf8 = cache.branchinfoutf8 You should get your revbranchcache on an unfiltered repo version. There is no good to expect from recreating it on a repoview and this will to extra invalidation for bad reason. > for r in revgen: > branchutf8, closesbranch = getbranchinfoutf8(r) > branch = encoding.tolocal(branchutf8) > newbranches.setdefault(branch, []).append(r) > if closesbranch: > self._closednodes.add(cl.node(r)) > + cache.save() You should probably move the save logic at the same place as the branchmap save logic.
Patch
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -234,13 +234,15 @@ cl = repo.changelog # collect new branch entries newbranches = {} - getbranchinfoutf8 = cl.branchinfoutf8 + cache = revbranchcache(repo) + getbranchinfoutf8 = cache.branchinfoutf8 for r in revgen: branchutf8, closesbranch = getbranchinfoutf8(r) branch = encoding.tolocal(branchutf8) newbranches.setdefault(branch, []).append(r) if closesbranch: self._closednodes.add(cl.node(r)) + cache.save() # fetch current topological heads to speed up filtering topoheads = set(cl.headrevs()) diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -31,6 +31,7 @@ default 10:a7949464abda $ ls .hg/cache branch2-served + revbranchnames Default operation: diff --git a/tests/test-fncache.t b/tests/test-fncache.t --- a/tests/test-fncache.t +++ b/tests/test-fncache.t @@ -71,6 +71,7 @@ .hg/00manifest.i .hg/cache .hg/cache/branch2-served + .hg/cache/revbranchnames .hg/data .hg/data/tst.d.hg .hg/data/tst.d.hg/foo.i @@ -99,6 +100,7 @@ .hg/00changelog.i .hg/cache .hg/cache/branch2-served + .hg/cache/revbranchnames .hg/dirstate .hg/last-message.txt .hg/requires diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t --- a/tests/test-hardlinks.t +++ b/tests/test-hardlinks.t @@ -196,6 +196,7 @@ 2 r4/.hg/00changelog.i 2 r4/.hg/branch 2 r4/.hg/cache/branch2-served + 2 r4/.hg/cache/revbranchnames 2 r4/.hg/dirstate 2 r4/.hg/hgrc 2 r4/.hg/last-message.txt @@ -226,6 +227,7 @@ 2 r4/.hg/00changelog.i 1 r4/.hg/branch 2 r4/.hg/cache/branch2-served + 2 r4/.hg/cache/revbranchnames 1 r4/.hg/dirstate 2 r4/.hg/hgrc 2 r4/.hg/last-message.txt diff --git a/tests/test-inherit-mode.t b/tests/test-inherit-mode.t --- a/tests/test-inherit-mode.t +++ b/tests/test-inherit-mode.t @@ -66,6 +66,7 @@ 00600 ./.hg/00changelog.i 00770 ./.hg/cache/ 00660 ./.hg/cache/branch2-served + 00660 ./.hg/cache/revbranchnames 00660 ./.hg/dirstate 00660 ./.hg/last-message.txt 00600 ./.hg/requires @@ -111,6 +112,7 @@ 00660 ../push/.hg/00changelog.i 00770 ../push/.hg/cache/ 00660 ../push/.hg/cache/branch2-base + 00660 ../push/.hg/cache/revbranchnames 00660 ../push/.hg/requires 00770 ../push/.hg/store/ 00660 ../push/.hg/store/00changelog.i