[PATCH 3 of 8] perf: add a perfbookmarks command

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Jun 8 15:44:19 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1496856131 -3600
#      Wed Jun 07 18:22:11 2017 +0100
# Node ID 1aac1d0629978bad92aca55dd47ee3ba7c28465c
# Parent  c54764352df4e2a648c76e8bea60f5631047de7a
# 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 1aac1d062997
perf: add a perfbookmarks command

A new command dedicated to benchmark of bookmark initialisation.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -467,6 +467,16 @@ def perfancestorset(ui, repo, revset, **
     timer(d)
     fm.end()
 
+ at command('perfbookmarks', formatteropts)
+def perfbookmarks(ui, repo, **opts):
+    """Benchmark parsing bookmarks from disk to memory"""
+    timer, fm = gettimer(ui, opts)
+    def d():
+        clearfilecache(repo, '_bookmarks')
+        repo._bookmarks
+    timer(d)
+    fm.end()
+
 @command('perfchangegroupchangelog', formatteropts +
          [('', 'version', '02', 'changegroup version'),
           ('r', 'rev', '', 'revisions to add to changegroup')])
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
@@ -51,6 +51,8 @@ perfstatus
                  (no help text available)
    perfannotate  (no help text available)
    perfbdiff     benchmark a bdiff between revisions
+   perfbookmarks
+                 Benchmark parsing bookmarks from disk to memory
    perfbranchmap
                  benchmark the update of a branchmap
    perfcca       (no help text available)
@@ -122,6 +124,7 @@ perfstatus
   $ hg perfannotate a
   $ hg perfbdiff -c 1
   $ hg perfbdiff --alldata 1
+  $ hg perfbookmarks
   $ hg perfbranchmap
   $ hg perfcca
   $ hg perfchangegroupchangelog


More information about the Mercurial-devel mailing list