perfdiscovery: benching findcommonheads()
This works between the local repo and any peer given by its path, and
should be useful for further work on discovery
Differential Revision: https://phab.mercurial-scm.org/D5418
--- a/contrib/perf.py Thu Dec 13 14:44:54 2018 -0500
+++ b/contrib/perf.py Thu Dec 13 17:10:03 2018 +0100
@@ -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'),
--- a/tests/test-contrib-perf.t Thu Dec 13 14:44:54 2018 -0500
+++ b/tests/test-contrib-perf.t Thu Dec 13 17:10:03 2018 +0100
@@ -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
------------------