Patchwork [1,of,3,V2] perf: add perfmoonwalk command to walk the changelog backwards

login
register
mail settings
Submitter Brodie Rao
Date Nov. 17, 2013, 11:09 p.m.
Message ID <6a0f892f23063abede20.1384729742@hit-nxdomain.opendns.com>
Download mbox | patch
Permalink /patch/3048/
State Accepted
Commit 74aea4be8e780566eb16977d240608b50200814e
Headers show

Comments

Brodie Rao - Nov. 17, 2013, 11:09 p.m.
# HG changeset patch
# User Brodie Rao <brodie@sf.io>
# Date 1384729468 18000
#      Sun Nov 17 18:04:28 2013 -0500
# Node ID 6a0f892f23063abede205bb130ba6257f1e9b7c0
# Parent  c38c3fdc8b9317ba09e03ab09364c3800da7c50c
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.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -243,6 +243,18 @@  def perflog(ui, repo, **opts):
                                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()