[PATCH] perfbranchmap: add an option to purge the revbranch cache

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jun 6 12:30:47 UTC 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1496676241 -3600
#      Mon Jun 05 16:24:01 2017 +0100
# Node ID 7841e806fa0e25886c1e72e51fbdb2ffb0f14a5b
# Parent  fc9296c15112af247e4985cdc45fbbf7d8eed175
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 7841e806fa0e
perfbranchmap: add an option to purge the revbranch cache

The perf extension needs to be able to reflect this reality too. (eg: 4s vs 60s
on a Million-ish revisions repository).

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1309,8 +1309,10 @@ def perfvolatilesets(ui, repo, *names, *
 @command('perfbranchmap',
          [('f', 'full', False,
            'Includes build time of subset'),
+          ('', 'clear-revbranch', False,
+           'purge the revbranch cache between computation'),
          ] + formatteropts)
-def perfbranchmap(ui, repo, full=False, **opts):
+def perfbranchmap(ui, repo, full=False, clear_revbranch=False, **opts):
     """benchmark the update of a branchmap
 
     This benchmarks the full repo.branchmap() call with read and write disabled
@@ -1323,6 +1325,8 @@ def perfbranchmap(ui, repo, full=False, 
         else:
             view = repo.filtered(filtername)
         def d():
+            if clear_revbranch:
+                repo.revbranchcache()._clear()
             if full:
                 view._branchcaches.clear()
             else:


More information about the Mercurial-devel mailing list