# HG changeset patch # User Pradeepkumar Gayam # Date 2010-07-27 15:20:09 # Node ID bf49d48e46024c0e1e5208301d4172f432954c90 # Parent ff33f937a7daa69d4f9cb4528745a0d8d5d323aa perf: add perfrevlog function to check performance of revlog diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -133,6 +133,16 @@ def perfdiffwd(ui, repo): 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 @@ cmdtable = { [('', 'rename', False, 'ask log to follow renames')]), 'perftemplating': (perftemplating, []), 'perfdiffwd': (perfdiffwd, []), + 'perfrevlog': (perfrevlog, [('d', 'dist', 100, 'distance between the revisions')],"[INDEXFILE]"), }