# HG changeset patch
# User Boris Feld <boris.f...@octobus.net>
# Date 1542628825 0
#      Mon Nov 19 12:00:25 2018 +0000
# Node ID 40c285f3b12012727bcdfd11984d81fe56386316
# Parent  dba590f27c7abacbd7e9b27f3e06822bb0b339cb
# EXP-Topic copy-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
40c285f3b120
perf: add a `perftracecopies` command to benchmark copy tracking logic

Before improving the situation, we should get a proper way to measure
improvements.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1146,6 +1146,24 @@ def perftemplating(ui, repo, testedtempl
     timer(format)
     fm.end()
 
+@command(b'perftracecopies', formatteropts +
+         [
+          (b's', b'source', b'', b'copy tracing source'),
+          (b'd', b'destination', b'', b'copy tracing destination'),
+         ])
+def perftracecopies(ui, repo, source, destination, **opts):
+    """measure time necessary to trace copy between <source> and <destination>
+    """
+    opts = _byteskwargs(opts)
+    timer, fm = gettimer(ui, opts)
+    src = scmutil.revsingle(repo, source)
+    dst = scmutil.revsingle(repo, destination)
+
+    def runone():
+        copies.pathcopies(repo[src], repo[dst])
+    timer(runone)
+    fm.end()
+
 @command(b'perfcca', formatteropts)
 def perfcca(ui, repo, **opts):
     opts = _byteskwargs(opts)
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
@@ -123,6 +123,9 @@ perfstatus
    perftags      (no help text available)
    perftemplating
                  test the rendering time of a given template
+   perftracecopies
+                 measure time necessary to trace copy between <source> and
+                 <destination>
    perfunidiff   benchmark a unified diff between revisions
    perfvolatilesets
                  benchmark the computation of various volatile set
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to