changeset 20178:74aea4be8e78

perf: add perfmoonwalk command to walk the changelog backwards This lets us test the effectiveness (or ineffectiveness) of the revlog chunk cache when walking revlogs backwards.
author Brodie Rao <brodie@sf.io>
date Sun, 17 Nov 2013 18:04:28 -0500
parents c5f0574034ef
children 5bb3826bdac4
files contrib/perf.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Tue Dec 03 13:28:04 2013 -0500
+++ b/contrib/perf.py	Sun Nov 17 18:04:28 2013 -0500
@@ -243,6 +243,18 @@
                                copies=opts.get('rename')))
     ui.popbuffer()
 
+@command('perfmoonwalk')
+def perfmoonwalk(ui, repo):
+    """benchmark walking the changelog backwards
+
+    This also loads the changelog data for each revision in the changelog.
+    """
+    def moonwalk():
+        for i in xrange(len(repo), -1, -1):
+            ctx = repo[i]
+            ctx.branch() # read changelog data (in addition to the index)
+    timer(moonwalk)
+
 @command('perftemplating')
 def perftemplating(ui, repo):
     ui.pushbuffer()