Patchwork [6,of,6] perftest: allow selection of volatile set to benchmark

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 4, 2013, 6:28 p.m.
Message ID <8d495cfd20eaf9983c5e.1357324133@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/392/
State Accepted
Commit f5ed27c51995c2f145b1a1f3226fc2a13ef559b5
Headers show

Comments

Pierre-Yves David - Jan. 4, 2013, 6:28 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1357323872 -3600
# Node ID 8d495cfd20eaf9983c5e5be2936dadc3472506fa
# Parent  c5a98600c967a317ea290a7a78ce9cfce614842b
perftest: allow selection of volatile set to benchmark

This helps when you focus on a subset of the volatile chain.
Kevin Bullock - Jan. 4, 2013, 7:01 p.m.
On Jan 4, 2013, at 12:28 PM, pierre-yves.david at logilab.fr wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1357323872 -3600
> # Node ID 8d495cfd20eaf9983c5e5be2936dadc3472506fa
> # Parent  c5a98600c967a317ea290a7a78ce9cfce614842b
> perftest: allow selection of volatile set to benchmark

Series LGTM.

pacem in terris / ??? / ?????? / ????????? / ??
Kevin R. Bullock
Bryan O'Sullivan - Jan. 7, 2013, 7:41 p.m.
On Fri, Jan 04, 2013 at 07:28:53PM +0100, pierre-yves.david at logilab.fr wrote:
> perftest: allow selection of volatile set to benchmark

Series pushed to crew, thanks.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -276,11 +276,11 @@  def perfrevset(ui, repo, expr, clear=Fal
             repo.invalidatevolatilesets()
         repo.revs(expr)
     timer(d)
 
 @command('perfvolatilesets')
-def perfvolatilesets(ui, repo):
+def perfvolatilesets(ui, repo, *names):
     """benchmark the computation of various volatile set
 
     Volatile set computes element related to filtering and obsolescence."""
     repo = repo.unfiltered()
 
@@ -288,16 +288,24 @@  def perfvolatilesets(ui, repo):
         def d():
             repo.invalidatevolatilesets()
             obsolete.getrevs(repo, name)
         return d
 
-    for name in sorted(obsolete.cachefuncs):
+    allobs = sorted(obsolete.cachefuncs)
+    if names:
+        allobs = [n for n in allobs if n in names]
+
+    for name in allobs:
         timer(getobs(name), title=name)
 
     def getfiltered(name):
         def d():
             repo.invalidatevolatilesets()
             repoview.filteredrevs(repo, name)
         return d
 
-    for name in sorted(repoview.filtertable):
+    allfilter = sorted(repoview.filtertable)
+    if names:
+        allfilter = [n for n in allfilter if n in names]
+
+    for name in allfilter:
         timer(getfiltered(name), title=name)