From patchwork Tue Mar 5 17:39:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5, of, 9, "] discovery: simply walk the undecided revs when building the children mapping From: Pierre-Yves David X-Patchwork-Id: 39081 Message-Id: <3f4f517d5ed962a0c2ae.1551807556@nodosa.octopoid.net> To: mercurial-devel@mercurial-scm.org Date: Tue, 05 Mar 2019 18:39:16 +0100 # HG changeset patch # User Pierre-Yves David # 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, [])