Patchwork D5418: perfdiscovery: benching findcommonheads()

login
register
mail settings
Submitter phabricator
Date Dec. 14, 2018, 3:50 p.m.
Message ID <d67f207729bd2c616390e6e37ae3ee93@localhost.localdomain>
Download mbox | patch
Permalink /patch/37138/
State Not Applicable
Headers show

Comments

phabricator - Dec. 14, 2018, 3:50 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG716ce792886c: perfdiscovery: benching findcommonheads() (authored by gracinet, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5418?vs=12837&id=12838

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

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

CHANGE DETAILS




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

Patch

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,21 @@ 
     timer(d)
     fm.end()
 
+@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)
+    path = ui.expandpath(path)
+
+    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'),