changeset 40741:4240a1da4188

perf: add --clear-revlog flag to branchmapload Having the changelog index already loaded when loading the branchmap can have a large impact on performance. Example runs (large private repository): hg perfbranchmapload -f base ! wall 0.116722 comb 0.120000 user 0.110000 sys 0.010000 (best of 59) hg perfbranchmapload -f base --clear-revlogs ! wall 0.258246 comb 0.230000 user 0.220000 sys 0.010000 (best of 31)
author Boris Feld <boris.feld@octobus.net>
date Fri, 23 Nov 2018 06:32:32 +0100
parents e4ea63855d5a
children d5b300ec2e89
files contrib/perf.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Fri Nov 23 06:32:28 2018 +0100
+++ b/contrib/perf.py	Fri Nov 23 06:32:32 2018 +0100
@@ -2232,10 +2232,13 @@
 @command(b'perfbranchmapload', [
      (b'f', b'filter', b'', b'Specify repoview filter'),
      (b'', b'list', False, b'List brachmap filter caches'),
+     (b'', b'clear-revlogs', False, b'refresh changelog and manifest'),
+
     ] + formatteropts)
 def perfbranchmapload(ui, repo, filter=b'', list=False, **opts):
     """benchmark reading the branchmap"""
     opts = _byteskwargs(opts)
+    clearrevlogs = opts[b'clear_revlogs']
 
     if list:
         for name, kind, st in repo.cachevfs.readdir(stat=True):
@@ -2253,9 +2256,12 @@
         raise error.Abort(b'No branchmap cached for %s repo'
                           % (filter or b'unfiltered'))
     timer, fm = gettimer(ui, opts)
+    def setup():
+        if clearrevlogs:
+            clearchangelog(repo)
     def bench():
         branchmap.read(repo)
-    timer(bench)
+    timer(bench, setup=setup)
     fm.end()
 
 @command(b'perfloadmarkers')