Patchwork perfbranchmap: add an option to purge the revbranch cache

login
register
mail settings
Submitter Pierre-Yves David
Date June 6, 2017, 12:30 p.m.
Message ID <7841e806fa0e25886c1e.1496752247@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21212/
State Accepted
Headers show

Comments

Pierre-Yves David - June 6, 2017, 12:30 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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).
Yuya Nishihara - June 7, 2017, 2:33 p.m.
On Tue, 06 Jun 2017 13:30:47 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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

Seems fine. Queued, thanks.

Patch

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: