[PATCH 4 of 7 Series-F] performance: speedup computation of mutable revisions
pierre-yves.david at logilab.fr
pierre-yves.david at logilab.fr
Tue Jan 8 18:54:03 UTC 2013
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1357570225 -3600
# Node ID 493d8c0157c1688d52044ff819f7e5ff66297662
# Parent 66e2c7a2eeb8e0ce02ec87fc1ca3197efafafe20
performance: speedup computation of mutable revisions
In they current state revset call can be very costly as we test predicates on
the will repository. The "mutable" filter is used during branch cache loading
operation. We better make it fast.
The current changeset drop revset call in favor of direct testing of the phase
of changeset.
Performance test on my Mercurial checkout
- 19857 total changesets,
- 1646 mutable revision
Before this changes, :
! mutable
! wall 0.032405 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)
After this changes:
! mutable
! wall 0.001469 comb 0.000000 user 0.000000 sys 0.000000 (best of 1841)
Performance test on a Mozilla central checkout:
- 117293 total changesets,
- 1 mutable changeset,
Before this changes, :
! mutable
! wall 0.188636 comb 0.190000 user 0.190000 sys 0.000000 (best of 52)
After this changes:
! mutable
! wall 0.000022 comb 0.000000 user 0.000000 sys 0.000000 (best of 93682)
diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -56,11 +56,13 @@ def computemutable(repo):
Secret and hidden changeset should not pretend to be here."""
assert not repo.changelog.filteredrevs
# fast check to avoid revset call on huge repo
if util.any(repo._phasecache.phaseroots[1:]):
- return frozenset(repo.revs('draft() + secret()'))
+ getphase = repo._phasecache.phase
+ maymutable = filteredrevs(repo, 'impactable')
+ return frozenset(r for r in maymutable if getphase(repo, r))
return frozenset()
def computeimpactable(repo):
"""Everything impactable by mutable revision
More information about the Mercurial-devel
mailing list