[PATCH 5 of 9 "] discovery: simply walk the undecided revs when building the children mapping

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Mar 5 12:39:16 EST 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1551797534 -3600
#      Tue Mar 05 15:52:14 2019 +0100
# Node ID 3f4f517d5ed962a0c2aef538ac81bfab28341355
# Parent  ffd98d208aa7f92e13bf233b6d752cd2d292ebbe
# EXP-Topic discovery-speedup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 3f4f517d5ed9
discovery: simply walk the undecided revs when building the children mapping

The sampling only care about revisions in the undecided set, so building children
relationship within this set is sufficient.

The set of undecided changesets can be much smaller than the full span from its
smallest item to the tip of the repository. This restriction can significantly
speed up operations in some cases.

For example, on our private pathological case, this speeds things up from about
53 seconds to about 7.5 seconds.

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -216,7 +216,7 @@ class partialdiscovery(object):
         # this by keeping a persistent cache of children across invocations.
         children = {}
 
-        for rev in repo.changelog.revs(start=min(revsroots)):
+        for rev in sorted(revs):
             # Always ensure revision has an entry so we don't need to worry
             # about missing keys.
             children.setdefault(rev, [])


More information about the Mercurial-devel mailing list