changeset 18274:254b708fd37d

performance: speedup computation of mutable revisions In their current state, revset calls can be very costly, as we test predicates on the entire repository. The "mutable" filter is used during branch cache loading operation. We need to make it fast. This change drops revset calls in favor of direct testing of the phase of a changeset. Performance test on my Mercurial checkout - 19857 total changesets, - 1646 mutable revision Before: ! mutable ! wall 0.032405 After: ! mutable ! wall 0.001469 Performance test on a Mozilla central checkout: - 117293 total changesets, - 1 mutable changeset, Before: ! mutable ! wall 0.188636 After: ! mutable ! wall 0.000022
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 07 Jan 2013 15:50:25 +0100
parents a2d54f68e13c
children 9818f22785b7
files mercurial/repoview.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/repoview.py	Fri Jan 04 20:19:05 2013 +0100
+++ b/mercurial/repoview.py	Mon Jan 07 15:50:25 2013 +0100
@@ -58,7 +58,9 @@
     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):