Mercurial > hg
comparison mercurial/repoview.py @ 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 | 1f35d6737ed8 |
comparison
equal
deleted
inserted
replaced
18273:a2d54f68e13c | 18274:254b708fd37d |
---|---|
56 | 56 |
57 Secret and hidden changeset should not pretend to be here.""" | 57 Secret and hidden changeset should not pretend to be here.""" |
58 assert not repo.changelog.filteredrevs | 58 assert not repo.changelog.filteredrevs |
59 # fast check to avoid revset call on huge repo | 59 # fast check to avoid revset call on huge repo |
60 if util.any(repo._phasecache.phaseroots[1:]): | 60 if util.any(repo._phasecache.phaseroots[1:]): |
61 return frozenset(repo.revs('draft() + secret()')) | 61 getphase = repo._phasecache.phase |
62 maymutable = filteredrevs(repo, 'impactable') | |
63 return frozenset(r for r in maymutable if getphase(repo, r)) | |
62 return frozenset() | 64 return frozenset() |
63 | 65 |
64 def computeimpactable(repo): | 66 def computeimpactable(repo): |
65 """Everything impactable by mutable revision | 67 """Everything impactable by mutable revision |
66 | 68 |