[PATCH 5 of 6] perftest: add a command to benchmark construction of volatile cache

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Fri Jan 4 12:28:52 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1357323806 -3600
# Node ID c5a98600c967a317ea290a7a78ce9cfce614842b
# Parent  8ff4097ce3bc5930a133fccead9c24dfe3318996
perftest: add a command to benchmark construction of volatile cache

Obsolescence and filtering related caches are critical. Having an handy way to
check them is valuable.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1,9 +1,10 @@
 # perf.py - performance test routines
 '''helper extension to measure performance'''
 
-from mercurial import cmdutil, scmutil, util, match, commands
+from mercurial import cmdutil, scmutil, util, match, commands, obsolete
+from mercurial import repoview
 import time, os, sys
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
 
@@ -273,5 +274,30 @@ def perfrevset(ui, repo, expr, clear=Fal
     def d():
         if clear:
             repo.invalidatevolatilesets()
         repo.revs(expr)
     timer(d)
+
+ at command('perfvolatilesets')
+def perfvolatilesets(ui, repo):
+    """benchmark the computation of various volatile set
+
+    Volatile set computes element related to filtering and obsolescence."""
+    repo = repo.unfiltered()
+
+    def getobs(name):
+        def d():
+            repo.invalidatevolatilesets()
+            obsolete.getrevs(repo, name)
+        return d
+
+    for name in sorted(obsolete.cachefuncs):
+        timer(getobs(name), title=name)
+
+    def getfiltered(name):
+        def d():
+            repo.invalidatevolatilesets()
+            repoview.filteredrevs(repo, name)
+        return d
+
+    for name in sorted(repoview.filtertable):
+        timer(getfiltered(name), title=name)


More information about the Mercurial-devel mailing list