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

login
register
mail settings
Submitter Pierre-Yves David
Date March 5, 2019, 5:39 p.m.
Message ID <3f4f517d5ed962a0c2ae.1551807556@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39081/
State Accepted
Headers show

Comments

Pierre-Yves David - March 5, 2019, 5:39 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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, [])