From 9044778c8c4f156cb790e8f73d9fe82a464b9920 Mon Sep 17 00:00:00 2001 From: Laurent Charignon Date: Fri, 24 Apr 2015 14:46:30 -0700 Subject: [PATCH] obsolete: speed up computation of bumped revset Speed up the computation of the bumped revset by using the not public() revset. In another patch series, we optimized the not public() revset. Together, this cuts the cost of the computation of bumped() from 17% of the total time of smartlog on our big repo to under 0.1% of the total time. --- mercurial/obsolete.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py index 3f85a58264..2860a52731 100644 --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -1139,19 +1139,18 @@ def _computebumpedset(repo): public = phases.public cl = repo.changelog torev = cl.nodemap.get - obs = getrevs(repo, 'obsolete') - for rev in repo: + for ctx in repo.set('(not public()) and (not obsolete())'): + rev = ctx.rev() # We only evaluate mutable, non-obsolete revision - if (public < phase(repo, rev)) and (rev not in obs): - node = cl.node(rev) - # (future) A cache of precursors may worth if split is very common - for pnode in allprecursors(repo.obsstore, [node], - ignoreflags=bumpedfix): - prev = torev(pnode) # unfiltered! but so is phasecache - if (prev is not None) and (phase(repo, prev) <= public): - # we have a public precursors - bumped.add(rev) - break # Next draft! + node = ctx.node() + # (future) A cache of precursors may worth if split is very common + for pnode in allprecursors(repo.obsstore, [node], + ignoreflags=bumpedfix): + prev = torev(pnode) # unfiltered! but so is phasecache + if (prev is not None) and (phase(repo, prev) <= public): + # we have a public precursors + bumped.add(rev) + break # Next draft! return bumped @cachefor('divergent')