Mercurial > hg-stable
changeset 18272:95ef7a87c053
performance: speedup computation of hidden revisions
In their current state, revset calls can be very costlys, as we
test predicates on the entire repository. The hidden filter is very
widely used, and needs to be very fast.
This change drops revset calls in favor of direct revision manipulation.
Performance test on my Mercurial checkout
- 19857 total changesets,
- 1584 obsolete changesets,
- 13310 obsolescence markers.
Before:
! hidden
! wall 0.077553
After this changes:
! hidden
! wall 0.011230
Performance test on a Mozilla central checkout:
- 117293 total changesets,
- 1 obsolete changeset,
- 1 obsolescence marker.
Before:
! hidden
! wall 0.389472
After:
! hidden
! wall 0.000079
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 04 Jan 2013 05:44:01 +0100 |
parents | 67872e939945 |
children | a2d54f68e13c |
files | mercurial/repoview.py |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/repoview.py Fri Jan 04 03:14:54 2013 +0100 +++ b/mercurial/repoview.py Fri Jan 04 05:44:01 2013 +0100 @@ -9,6 +9,7 @@ import copy import phases import util +import obsolete, bookmarks, revset def computehidden(repo): @@ -16,10 +17,19 @@ During most operation hidden should be filtered.""" assert not repo.changelog.filteredrevs - if repo.obsstore: - ### hide extinct changeset that are not accessible by any mean - hiddenquery = 'extinct() - ::(parents() + bookmark())' - return frozenset(repo.revs(hiddenquery)) + hideable = obsolete.getrevs(repo, 'obsolete') + if hideable: + cl = repo.changelog + firsthideable = min(hideable) + revs = cl.revs(start=firsthideable) + blockers = [r for r in revset._children(repo, revs, hideable) + if r not in hideable] + for par in repo[None].parents(): + blockers.append(par.rev()) + for bm in bookmarks.listbookmarks(repo).values(): + blockers.append(repo[bm].rev()) + blocked = cl.ancestors(blockers, inclusive=True) + return frozenset(r for r in hideable if r not in blocked) return frozenset() def computeunserved(repo):