perf: add a perfbookmarks command
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 07 Jun 2017 18:22:11 +0100
changeset 32733 2b0a8b0f3435
parent 32732 e36569bd9e28
child 32734 b5613bda454e
perf: add a perfbookmarks command A new command dedicated to benchmark of bookmark initialization.
contrib/perf.py
tests/test-contrib-perf.t
--- a/contrib/perf.py	Tue May 23 02:27:41 2017 +0200
+++ b/contrib/perf.py	Wed Jun 07 18:22:11 2017 +0100
@@ -467,6 +467,16 @@
     timer(d)
     fm.end()
 
+@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')])
--- a/tests/test-contrib-perf.t	Tue May 23 02:27:41 2017 +0200
+++ b/tests/test-contrib-perf.t	Wed Jun 07 18:22:11 2017 +0100
@@ -51,6 +51,8 @@
                  (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 @@
   $ hg perfannotate a
   $ hg perfbdiff -c 1
   $ hg perfbdiff --alldata 1
+  $ hg perfbookmarks
   $ hg perfbranchmap
   $ hg perfcca
   $ hg perfchangegroupchangelog