changeset 11694:bf49d48e4602

perf: add perfrevlog function to check performance of revlog
author Pradeepkumar Gayam <in3xes@gmail.com>
date Tue, 27 Jul 2010 20:50:09 +0530
parents ff33f937a7da
children ee8f36a6c766
files contrib/perf.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Tue Jul 27 01:16:38 2010 +0530
+++ b/contrib/perf.py	Tue Jul 27 20:50:09 2010 +0530
@@ -133,6 +133,16 @@
         title = 'diffopts: %s' % (diffopt and ('-' + diffopt) or 'none')
         timer(d, title)
 
+def perfrevlog(ui, repo, file_, **opts):
+    from mercurial import revlog
+    dist = opts['dist']
+    def d():
+        r = revlog.revlog(lambda fn: open(fn, 'rb'), file_)
+        for x in xrange(0, len(r), dist):
+            r.revision(r.node(x))
+
+    timer(d)
+
 cmdtable = {
     'perflookup': (perflookup, []),
     'perfparents': (perfparents, []),
@@ -149,4 +159,5 @@
                 [('', 'rename', False, 'ask log to follow renames')]),
     'perftemplating': (perftemplating, []),
     'perfdiffwd': (perfdiffwd, []),
+    'perfrevlog': (perfrevlog, [('d', 'dist', 100, 'distance between the revisions')],"[INDEXFILE]"),
 }