[PATCH 1 of 3] perfphases: add 'perfphases' command

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue May 23 14:04:21 UTC 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1495498987 -7200
#      Tue May 23 02:23:07 2017 +0200
# Node ID e7b7317363359a4bb15b5713ff034c6fd2008339
# Parent  e8c043375b53b30c4b468687f08323cbeeb452ef
# EXP-Topic perf
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e7b731736335
perfphases: add 'perfphases' command

This commands benchmark the time spend computing the data in a repository.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -581,6 +581,17 @@ def perfpathcopies(ui, repo, rev1, rev2,
     timer(d)
     fm.end()
 
+ at command('perfphases', [], "")
+def perfphases(ui, repo, **opts):
+    """benchmark phasesets computation"""
+    timer, fm = gettimer(ui, opts)
+    phases = repo._phasecache
+    def d():
+        phases.invalidate()
+        phases.loadphaserevs(repo)
+    timer(d)
+    fm.end()
+
 @command('perfmanifest', [], 'REV')
 def perfmanifest(ui, repo, rev, **opts):
     timer, fm = gettimer(ui, opts)
diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t
--- a/tests/test-contrib-perf.t
+++ b/tests/test-contrib-perf.t
@@ -93,6 +93,7 @@ perfstatus
    perfparents   (no help text available)
    perfpathcopies
                  (no help text available)
+   perfphases    benchmark phasesets computation
    perfrawfiles  (no help text available)
    perfrevlog    Benchmark reading a series of revisions from a revlog.
    perfrevlogchunks


More information about the Mercurial-devel mailing list