Patchwork [1,of,8,V6] perf: add a `perftracecopies` command to benchmark copy tracking logic

login
register
mail settings
Submitter Boris Feld
Date Nov. 19, 2018, 4:49 p.m.
Message ID <40c285f3b12012727bcd.1542646180@localhost.localdomain>
Download mbox | patch
Permalink /patch/36650/
State Accepted
Headers show

Comments

Boris Feld - Nov. 19, 2018, 4:49 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@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.
Yuya Nishihara - Nov. 24, 2018, 2:29 a.m.
On Mon, 19 Nov 2018 17:49:40 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@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

> 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()

I just found there's perfpathcopies.
Yuya Nishihara - Nov. 24, 2018, 3:01 a.m.
On Sat, 24 Nov 2018 11:29:48 +0900, Yuya Nishihara wrote:
> On Mon, 19 Nov 2018 17:49:40 +0100, Boris Feld wrote:
> > # HG changeset patch
> > # User Boris Feld <boris.feld@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
> 
> > 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()
> 
> I just found there's perfpathcopies.

Dropped this as I can rebase the descendants right now.

Patch

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