changeset 42425:b9ff059fd194

discovery: be more conservative when adjusting the sample size Since 5b34972a0094, the discovery will increase the sample size when it detect a "complex" undecided set. However this detection focussed on the number of roots only, this could regress discovery performance when the undecided set has many roots that eventually get merged into a few heads. To prevent such misbehavior, we adjust the logic to take in account both heads and roots. The sample size will be increased only if both are especially large. Performance testing on the same case as 5b34972a0094, does not show a significant difference.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 05 Jun 2019 11:23:25 +0200
parents d3b5cbe311d9
children a1f87294471f
files mercurial/setdiscovery.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/setdiscovery.py	Thu May 16 16:22:20 2019 +0200
+++ b/mercurial/setdiscovery.py	Wed Jun 05 11:23:25 2019 +0200
@@ -242,13 +242,13 @@
 
         # update from roots
         revsroots = set(repo.revs('roots(%ld)', revs))
-        if not self._respectsize:
-            size = max(size, len(revsroots))
-
         childrenrevs = self._childrengetter()
-
         _updatesample(revs, revsroots, sample, childrenrevs)
         assert sample
+
+        if not self._respectsize:
+            size = max(size, min(len(revsroots), len(revsheads)))
+
         sample = _limitsample(sample, size)
         if len(sample) < size:
             more = size - len(sample)