Mercurial > hg-stable
changeset 18271:67872e939945
performance: speedup computation of obsolete revisions
In their current state, revset calls can be very costly as we test
predicates on the entire repository. As obsolete computation is used
by the "hidden" filter, it needs to be very fast.
This changet drops the revset call in favor of direct testing of
the phase of a changeset.
Performance test on my Mercurial checkout
- 19857 total changesets,
- 1584 obsolete changesets,
- 13310 obsolescence markers.
Before:
! obsolete
! wall 0.047041
After:
! obsolete
! wall 0.004590
Performance test on a Mozilla central checkout:
- 117293 total changesets,
- 1 obsolete changeset,
- 1 obsolescence marker.
Before:
! obsolete
! wall 0.001539
After:
! obsolete
! wall 0.000017
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 04 Jan 2013 03:14:54 +0100 |
parents | 48deb483a8f8 |
children | 95ef7a87c053 |
files | mercurial/obsolete.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/obsolete.py Mon Dec 24 12:00:08 2012 +0100 +++ b/mercurial/obsolete.py Fri Jan 04 03:14:54 2013 +0100 @@ -649,12 +649,13 @@ def _computeobsoleteset(repo): """the set of obsolete revisions""" obs = set() - nm = repo.changelog.nodemap + getrev = repo.changelog.nodemap.get + getphase = repo._phasecache.phase for node in repo.obsstore.successors: - rev = nm.get(node) - if rev is not None: + rev = getrev(node) + if rev is not None and getphase(repo, rev): obs.add(rev) - return set(repo.revs('%ld - public()', obs)) + return obs @cachefor('unstable') def _computeunstableset(repo):