# HG changeset patch # User Pierre-Yves David # Date 1357570225 -3600 # Node ID 254b708fd37d2d5e13710e3a5c8cd1fac9c45ab8 # Parent a2d54f68e13cb68132a161617b8e5386eec49047 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 diff -r a2d54f68e13c -r 254b708fd37d mercurial/repoview.py --- 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):