[PATCH 4 of 5] perf: add a new `perfmergecopies` command

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu May 23 12:47:58 EDT 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1558615682 -7200
#      Thu May 23 14:48:02 2019 +0200
# Node ID 2a0e626bc8f1b7ac1cf38789fcc32876f8684f91
# Parent  1587f4e0cca53e0f6074599c079b664461877dfb
# EXP-Topic perf-mergecopies
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 2a0e626bc8f1
perf: add a new `perfmergecopies` command

This command benchmark calls to `mercuria.copies.mergecopies`

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -963,6 +963,24 @@ def perfmergecalculate(ui, repo, **opts)
     timer(d)
     fm.end()
 
+ at command(b'perfmergecopies',
+         [
+             (b'r', b'rev', b'.', b'rev to merge against'),
+             (b'', b'from', b'', b'rev to merge from'),
+             (b'', b'base', b'', b'the revision to use as base'),
+         ] + formatteropts)
+def perfmergecopies(ui, repo, **opts):
+    """measure runtime of `copies.mergecopies`"""
+    opts = _byteskwargs(opts)
+    timer, fm = gettimer(ui, opts)
+    wctx, rctx, ancestor = _getmergerevs(repo, opts)
+    def d():
+        # acceptremote is True because we don't want prompts in the middle of
+        # our benchmark
+        copies.mergecopies(repo, wctx, rctx, ancestor)
+    timer(d)
+    fm.end()
+
 @command(b'perfpathcopies', [], b"REV REV")
 def perfpathcopies(ui, repo, rev1, rev2, **opts):
     """benchmark the copy tracing logic"""
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
@@ -134,6 +134,8 @@ perfstatus
                  usable
    perfmergecalculate
                  (no help text available)
+   perfmergecopies
+                 measure runtime of 'copies.mergecopies'
    perfmoonwalk  benchmark walking the changelog backwards
    perfnodelookup
                  (no help text available)


More information about the Mercurial-devel mailing list