contrib/perf.py
changeset 40772 5cbb74999040
parent 40771 58355a1de6b3
child 40783 e207f0d6c243
--- a/contrib/perf.py	Wed Nov 21 21:11:47 2018 +0000
+++ b/contrib/perf.py	Fri Nov 23 01:09:37 2018 +0100
@@ -2285,10 +2285,16 @@
 @command(b'perfbranchmapupdate', [
      (b'', b'base', [], b'subset of revision to start from'),
      (b'', b'target', [], b'subset of revision to end with'),
+     (b'', b'clear-caches', False, b'clear cache between each runs')
     ] + formatteropts)
 def perfbranchmapupdate(ui, repo, base=(), target=(), **opts):
     """benchmark branchmap update from for <base> revs to <target> revs
 
+    If `--clear-caches` is passed, the following items will be reset before
+    each update:
+        * the changelog instance and associated indexes
+        * the rev-branch-cache instance
+
     Examples:
 
        # update for the one last revision
@@ -2301,6 +2307,7 @@
     from mercurial import repoview
     opts = _byteskwargs(opts)
     timer, fm = gettimer(ui, opts)
+    clearcaches = opts[b'clear_caches']
     unfi = repo.unfiltered()
     x = [None] # used to pass data between closure
 
@@ -2366,6 +2373,9 @@
 
         def setup():
             x[0] = base.copy()
+            if clearcaches:
+                unfi._revbranchcache = None
+                clearchangelog(repo)
 
         def bench():
             x[0].update(targetrepo, newrevs)