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