changeset 32272:4c6b2076d292

perf: move revlog construction and length calculation out of benchmark We don't need to measure the time it takes to open the revlog or calculate its length. This is more consistent with what other perf* functions do. While I was here, I also renamed the revlog variable from "r" to "rl" - again in the name of consistency.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 06 May 2017 11:16:59 -0700
parents 954f63391d71
children feb910d2f59b
files contrib/perf.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Sat May 06 11:15:56 2017 -0700
+++ b/contrib/perf.py	Sat May 06 11:16:59 2017 -0700
@@ -850,14 +850,14 @@
 
     The start revision can be defined via ``-s/--startrev``.
     """
-    _len = getlen(ui)
+    rl = cmdutil.openrevlog(repo, 'perfrevlog', file_, opts)
+    rllen = getlen(ui)(rl)
 
     def d():
-        r = cmdutil.openrevlog(repo, 'perfrevlog', file_, opts)
-        r.clearcaches()
+        rl.clearcaches()
 
         beginrev = startrev
-        endrev = _len(r)
+        endrev = rllen
         dist = opts['dist']
 
         if reverse:
@@ -865,7 +865,7 @@
             dist = -1 * dist
 
         for x in xrange(beginrev, endrev, dist):
-            r.revision(x)
+            rl.revision(x)
 
     timer, fm = gettimer(ui, opts)
     timer(d)