# HG changeset patch # User Laurent Charignon # Date 1429911990 25200 # Node ID cd0068232ec0940a6bcbd9eb661d7b0569a7d960 # Parent 3fe1e07f1a325f1fe12709573be6b1997cbb7f85 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. diff -r 3fe1e07f1a32 -r cd0068232ec0 mercurial/obsolete.py --- a/mercurial/obsolete.py Thu Mar 19 13:15:20 2015 -0700 +++ b/mercurial/obsolete.py Fri Apr 24 14:46:30 2015 -0700 @@ -1139,19 +1139,18 @@ 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')