Patchwork [4,of,4] perf: cache revlog file handle during perfrevlog

login
register
mail settings
Submitter Gregory Szorc
Date Nov. 2, 2016, 1:16 a.m.
Message ID <f7ad41bbe7d5d6037413.1478049399@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/17258/
State Superseded
Headers show

Comments

Gregory Szorc - Nov. 2, 2016, 1:16 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1476649617 25200
#      Sun Oct 16 13:26:57 2016 -0700
# Node ID f7ad41bbe7d5d6037413100e9f218380ebe1a14a
# Parent  45759b1b6883c2f4b1fc0227710150ef94380927
perf: cache revlog file handle during perfrevlog

The aim of perfrevlog is to measure how fast revlog revisions
can be resolved, not I/O. Since we now have a mechanism to cache
an open file handle on a revlog instance, let's use it.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -793,8 +793,9 @@  def perfrevlog(ui, repo, file_=None, sta
             startrev, endrev = endrev, startrev
             dist = -1 * dist
 
-        for x in xrange(startrev, endrev, dist):
-            r.revision(r.node(x))
+        with r.cachefilehandle():
+            for x in xrange(startrev, endrev, dist):
+                r.revision(r.node(x))
 
     timer(d)
     fm.end()