perf: make start revision configurable for perfrevlog
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Dec 2015 19:56:23 -0800
changeset 27493 14b0930105da
parent 27492 ac549d7fbc2b
child 27494 cc87d2c01ea5
perf: make start revision configurable for perfrevlog This will help isolate performance characteristics of delta chains.
contrib/perf.py
--- a/contrib/perf.py	Sun Dec 20 19:45:55 2015 -0800
+++ b/contrib/perf.py	Sun Dec 20 19:56:23 2015 -0800
@@ -475,20 +475,23 @@
     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)