Patchwork [2,of,2] perf: make start revision configurable for perfrevlog

login
register
mail settings
Submitter Gregory Szorc
Date Dec. 22, 2015, 6:49 a.m.
Message ID <aad9b962087274a493ee.1450766994@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/12236/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Gregory Szorc - Dec. 22, 2015, 6:49 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1450670183 28800
#      Sun Dec 20 19:56:23 2015 -0800
# Node ID aad9b962087274a493ee989351171a6878313f82
# Parent  4e4279304032983bca4c28eba354cbe53df9e1e8
perf: make start revision configurable for perfrevlog

This will help isolate performance characteristics of delta chains.
Augie Fackler - Dec. 29, 2015, 10:11 p.m.
On Mon, Dec 21, 2015 at 10:49:54PM -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1450670183 28800
> #      Sun Dec 20 19:56:23 2015 -0800
> # Node ID aad9b962087274a493ee989351171a6878313f82
> # Parent  4e4279304032983bca4c28eba354cbe53df9e1e8
> perf: make start revision configurable for perfrevlog

queued these, thanks

>
> This will help isolate performance characteristics of delta chains.
>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -470,30 +470,33 @@ def perfdiffwd(ui, repo, **opts):
>              ui.pushbuffer()
>              commands.diff(ui, repo, **opts)
>              ui.popbuffer()
>          title = 'diffopts: %s' % (diffopt and ('-' + diffopt) or 'none')
>          timer(d, title)
>      fm.end()
>
>  @command('perfrevlog', revlogopts + formatteropts +
> -         [('d', 'dist', 100, 'distance between the revisions')],
> +         [('d', 'dist', 100, 'distance between the revisions'),
> +          ('s', 'startrev', 0, 'revision to start reading at')],
>           '-c|-m|FILE')
> -def perfrevlog(ui, repo, file_=None, **opts):
> +def perfrevlog(ui, repo, file_=None, startrev=0, **opts):
>      """Benchmark reading a series of revisions from a revlog.
>
>      By default, we read every ``-d/--dist`` revision from 0 to tip of
>      the specified revlog.
> +
> +    The start revision can be defined via ``-s/--startrev``.
>      """
>      timer, fm = gettimer(ui, opts)
>      dist = opts['dist']
>      _len = getlen(ui)
>      def d():
>          r = cmdutil.openrevlog(repo, 'perfrevlog', file_, opts)
> -        for x in xrange(0, _len(r), dist):
> +        for x in xrange(startrev, _len(r), dist):
>              r.revision(r.node(x))
>
>      timer(d)
>      fm.end()
>
>  @command('perfrevlogrevision', revlogopts + formatteropts +
>           [('', 'cache', False, 'use caches instead of clearing')],
>           '-c|-m|FILE REV')
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -470,30 +470,33 @@  def perfdiffwd(ui, repo, **opts):
             ui.pushbuffer()
             commands.diff(ui, repo, **opts)
             ui.popbuffer()
         title = 'diffopts: %s' % (diffopt and ('-' + diffopt) or 'none')
         timer(d, title)
     fm.end()
 
 @command('perfrevlog', revlogopts + formatteropts +
-         [('d', 'dist', 100, 'distance between the revisions')],
+         [('d', 'dist', 100, 'distance between the revisions'),
+          ('s', 'startrev', 0, 'revision to start reading at')],
          '-c|-m|FILE')
-def perfrevlog(ui, repo, file_=None, **opts):
+def perfrevlog(ui, repo, file_=None, startrev=0, **opts):
     """Benchmark reading a series of revisions from a revlog.
 
     By default, we read every ``-d/--dist`` revision from 0 to tip of
     the specified revlog.
+
+    The start revision can be defined via ``-s/--startrev``.
     """
     timer, fm = gettimer(ui, opts)
     dist = opts['dist']
     _len = getlen(ui)
     def d():
         r = cmdutil.openrevlog(repo, 'perfrevlog', file_, opts)
-        for x in xrange(0, _len(r), dist):
+        for x in xrange(startrev, _len(r), dist):
             r.revision(r.node(x))
 
     timer(d)
     fm.end()
 
 @command('perfrevlogrevision', revlogopts + formatteropts +
          [('', 'cache', False, 'use caches instead of clearing')],
          '-c|-m|FILE REV')