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

login
register
mail settings
Submitter Brodie Rao
Date Nov. 17, 2013, 7:51 p.m.
Message ID <cd18bc43b89a33f321b2.1384717903@hit-nxdomain.opendns.com>
Download mbox | patch
Permalink /patch/3026/
State Superseded
Headers show

Comments

Brodie Rao - Nov. 17, 2013, 7:51 p.m.
# HG changeset patch
# User Brodie Rao <brodie@sf.io>
# Date 1384713197 18000
#      Sun Nov 17 13:33:17 2013 -0500
# Node ID cd18bc43b89a33f321b2025b4e7e32c8f33f4614
# 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.
Augie Fackler - Nov. 17, 2013, 10:08 p.m.
On Sun, Nov 17, 2013 at 02:51:43PM -0500, Brodie Rao wrote:
> # HG changeset patch
> # User Brodie Rao <brodie@sf.io>
> # Date 1384713197 18000
> #      Sun Nov 17 13:33:17 2013 -0500
> # Node ID cd18bc43b89a33f321b2025b4e7e32c8f33f4614
> # 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.
>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -243,6 +243,14 @@ def perflog(ui, repo, **opts):
>                                 copies=opts.get('rename')))
>      ui.popbuffer()
>
> +@command('perfmoonwalk')
> +def perfmoonwalk(ui, repo):

Name is clever and mpm likes it, but it at least needs a docstring
about what it's doing so future self doesn't forget what it does.

> +    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()
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -243,6 +243,14 @@  def perflog(ui, repo, **opts):
                                copies=opts.get('rename')))
     ui.popbuffer()
 
+@command('perfmoonwalk')
+def perfmoonwalk(ui, repo):
+    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()