D5418: perfdiscovery: benching findcommonheads()

gracinet (Georges Racinet) phabricator at mercurial-scm.org
Thu Dec 13 17:21:00 UTC 2018


gracinet created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This works between the local repo and any peer given by its path, and
  should be useful for further work on discovery

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5418

AFFECTED FILES
  contrib/perf.py
  tests/test-contrib-perf.t

CHANGE DETAILS

diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t
--- a/tests/test-contrib-perf.t
+++ b/tests/test-contrib-perf.t
@@ -79,6 +79,9 @@
                  (no help text available)
    perfdirstatewrite
                  (no help text available)
+   perfdiscovery
+                 benchmark discovery between local repo and the peer at given
+                 path
    perffncacheencode
                  (no help text available)
    perffncacheload
@@ -206,6 +209,7 @@
   $ hg perfvolatilesets
   $ hg perfwalk
   $ hg perfparents
+  $ hg perfdiscovery -q .
 
 test actual output
 ------------------
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -37,6 +37,7 @@
     copies,
     error,
     extensions,
+    hg,
     mdiff,
     merge,
     revlog,
@@ -67,6 +68,11 @@
     from mercurial import scmutil # since 1.9 (or 8b252e826c68)
 except ImportError:
     pass
+try:
+    from mercurial import setdiscovery # since 1.9 (or cb98fed52495)
+except ImportError:
+    pass
+
 
 def identity(a):
     return a
@@ -581,6 +587,20 @@
     timer(d)
     fm.end()
 
+ at command(b'perfdiscovery', formatteropts, b'PATH')
+def perfdiscovery(ui, repo, path, **opts):
+    """benchmark discovery between local repo and the peer at given path
+    """
+    repos = [repo, None]
+    timer, fm = gettimer(ui, opts)
+
+    def s():
+        repos[1] = hg.peer(ui, opts, path)
+    def d():
+        setdiscovery.findcommonheads(ui, *repos)
+    timer(d, setup=s)
+    fm.end()
+
 @command(b'perfbookmarks', formatteropts +
         [
             (b'', b'clear-revlogs', False, b'refresh changelog and manifest'),



To: gracinet, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list