Patchwork discovery: compute newly discovered missing in a more efficient way

login
register
mail settings
Submitter Boris Feld
Date Jan. 14, 2019, 12:17 p.m.
Message ID <39d6a1edd0b944c3590d.1547468263@localhost.localdomain>
Download mbox | patch
Permalink /patch/37728/
State Accepted
Headers show

Comments

Boris Feld - Jan. 14, 2019, 12:17 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1546614288 -3600
#      Fri Jan 04 16:04:48 2019 +0100
# Node ID 39d6a1edd0b944c3590d95b8af3686059ede574a
# Parent  8d0d695fc7910665452b81052d1bbc55b3829b14
# EXP-Topic discovery.revset
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 39d6a1edd0b9
discovery: compute newly discovered missing in a more efficient way

Calling "descendants" is expensive, instead, we bound the walk inside the know set
of undecided revision.

This help with discovery performance:

# without the revset '%ld' improvement
$ hg perfdiscovery -R pypy-left pypy-right
before: wall 0.675631 comb 0.680000 user 0.670000 sys 0.010000 (median of 15)
after:  wall 0.520145 comb 0.530000 user 0.510000 sys 0.020000 (median of 19)

There is another series in flight that greatly improves performances of "%ld"
substitution in `repo.revs` call. If this changeset is applied above it, we
see a similar performance boost.

# with the revset '%ld' improvement
$ hg perfdiscovery -R pypy-left pypy-right
before: wall 0.477848 comb 0.480000 user 0.480000 sys 0.000000 (median of 22)
after:  wall 0.404163 comb 0.400000 user 0.400000 sys 0.000000 (median of 24)
Yuya Nishihara - Jan. 17, 2019, 11:57 a.m.
On Mon, 14 Jan 2019 13:17:43 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1546614288 -3600
> #      Fri Jan 04 16:04:48 2019 +0100
> # Node ID 39d6a1edd0b944c3590d95b8af3686059ede574a
> # Parent  8d0d695fc7910665452b81052d1bbc55b3829b14
> # EXP-Topic discovery.revset
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 39d6a1edd0b9
> discovery: compute newly discovered missing in a more efficient way

Queued, thanks.

Patch

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -187,14 +187,10 @@  class partialdiscovery(object):
 
     def addmissings(self, missings):
         """registrer some nodes as missing"""
-        if self.missing:
-            new = self._repo.revs('descendants(%ld) - descendants(%ld)',
-                                  missings, self.missing)
-            self.missing.update(new)
-        else:
-            self.missing.update(self._repo.revs('descendants(%ld)', missings))
-
-        self.undecided.difference_update(self.missing)
+        newmissing = self._repo.revs('%ld::%ld', missings, self.undecided)
+        if newmissing:
+            self.missing.update(newmissing)
+            self.undecided.difference_update(newmissing)
 
     def addinfo(self, sample):
         """consume an iterable of (rev, known) tuples"""