# HG changeset patch # User Pierre-Yves David # Date 1512874188 -3600 # Node ID 8ebd31af14528823a34eeaa9bd8354c418b48de9 # Parent 83d2a2f3dc8f192107bcc9858abcfa85fc4a1fad stablesort: warm jump cache more efficiently We no longer for a full depth iteration for all request: - we exit early for non-merge, - for merge, we only iterate over the exclusive area. diff -r 83d2a2f3dc8f -r 8ebd31af1452 hgext3rd/evolve/stablesort.py --- a/hgext3rd/evolve/stablesort.py Sun Dec 10 03:39:56 2017 +0100 +++ b/hgext3rd/evolve/stablesort.py Sun Dec 10 03:49:48 2017 +0100 @@ -331,10 +331,16 @@ def getjumps(self, repo, rev): if rev not in self._jumps: - # still won't load anything if rev is not a merge - self.get(repo, rev) # we can be smarter here - if rev not in self._jumps: + parents = repo.changelog.parentrevs(rev) + if parents[1] == nodemod.nullrev: self._jumps[rev] = None + else: + # merge ! warn the cache + tiebreaker = _mergepoint_tie_breaker(repo) + minparent = sorted(parents, key=tiebreaker)[0] + for r in self.walkfrom(repo, rev): + if r == minparent: + break return self._jumps[rev] def walkfrom(self, repo, head):