# HG changeset patch # User Pierre-Yves David # Date 1558615682 -7200 # Node ID f5f0a9490c05817b71d583f21ee4a7b60d461e58 # Parent 3a3592b40a954abc9703e9f7fb103dc28f4c3894 perf: add a new `perfmergecopies` command This command benchmark calls to `mercurial.copies.mergecopies` diff -r 3a3592b40a95 -r f5f0a9490c05 contrib/perf.py --- a/contrib/perf.py Thu May 23 14:02:01 2019 +0200 +++ b/contrib/perf.py Thu May 23 14:48:02 2019 +0200 @@ -1004,6 +1004,24 @@ timer(d) fm.end() +@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 -r 3a3592b40a95 -r f5f0a9490c05 tests/test-contrib-perf.t --- a/tests/test-contrib-perf.t Thu May 23 14:02:01 2019 +0200 +++ b/tests/test-contrib-perf.t Thu May 23 14:48:02 2019 +0200 @@ -141,6 +141,8 @@ usable perfmergecalculate (no help text available) + perfmergecopies + measure runtime of 'copies.mergecopies' perfmoonwalk benchmark walking the changelog backwards perfnodelookup (no help text available)