##// END OF EJS Templates
perf: add --reverse to perfrevlog...
Gregory Szorc -
r30017:973cf6c3 default
parent child Browse files
Show More
@@ -580,9 +580,10 b' def perfdiffwd(ui, repo, **opts):'
580
580
581 @command('perfrevlog', revlogopts + formatteropts +
581 @command('perfrevlog', revlogopts + formatteropts +
582 [('d', 'dist', 100, 'distance between the revisions'),
582 [('d', 'dist', 100, 'distance between the revisions'),
583 ('s', 'startrev', 0, 'revision to start reading at')],
583 ('s', 'startrev', 0, 'revision to start reading at'),
584 ('', 'reverse', False, 'read in reverse')],
584 '-c|-m|FILE')
585 '-c|-m|FILE')
585 def perfrevlog(ui, repo, file_=None, startrev=0, **opts):
586 def perfrevlog(ui, repo, file_=None, startrev=0, reverse=False, **opts):
586 """Benchmark reading a series of revisions from a revlog.
587 """Benchmark reading a series of revisions from a revlog.
587
588
588 By default, we read every ``-d/--dist`` revision from 0 to tip of
589 By default, we read every ``-d/--dist`` revision from 0 to tip of
@@ -591,11 +592,20 b' def perfrevlog(ui, repo, file_=None, sta'
591 The start revision can be defined via ``-s/--startrev``.
592 The start revision can be defined via ``-s/--startrev``.
592 """
593 """
593 timer, fm = gettimer(ui, opts)
594 timer, fm = gettimer(ui, opts)
594 dist = opts['dist']
595 _len = getlen(ui)
595 _len = getlen(ui)
596
596 def d():
597 def d():
597 r = cmdutil.openrevlog(repo, 'perfrevlog', file_, opts)
598 r = cmdutil.openrevlog(repo, 'perfrevlog', file_, opts)
598 for x in xrange(startrev, _len(r), dist):
599
600 startrev = 0
601 endrev = _len(r)
602 dist = opts['dist']
603
604 if reverse:
605 startrev, endrev = endrev, startrev
606 dist = -1 * dist
607
608 for x in xrange(startrev, endrev, dist):
599 r.revision(r.node(x))
609 r.revision(r.node(x))
600
610
601 timer(d)
611 timer(d)
General Comments 0
You need to be logged in to leave comments. Login now