[PATCH 8 of 8 V2] perf: add a `--clear-caches` to `perfbranchmapupdate`
Boris Feld
boris.feld at octobus.net
Mon Nov 26 18:44:39 UTC 2018
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1542931777 -3600
# Fri Nov 23 01:09:37 2018 +0100
# Node ID d5e0cfcc409ed9f71a7bd85a711f810151ed8c5e
# Parent 41772e57bfc92d38899b24f729d992c39dc32473
# EXP-Topic perf-branchmap
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d5e0cfcc409e
perf: add a `--clear-caches` to `perfbranchmapupdate`
This flag will help to measure the time we spend loading various cache that
support the branchmap update.
Example for an 500 000 revisions repository:
hg perfbranchmapupdate --base 'not tip' --target 'tip'
! wall 0.000860 comb 0.000000 user 0.000000 sys 0.000000 (best of 336)
hg perfbranchmapupdate --base 'not tip' --target 'tip' --clear-caches
! wall 0.029494 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -2234,10 +2234,16 @@ def perfbranchmap(ui, repo, *filternames
@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
@@ -2250,6 +2256,7 @@ def perfbranchmapupdate(ui, repo, base=(
from mercurial import repoview
opts = _byteskwargs(opts)
timer, fm = gettimer(ui, opts)
+ clearcaches = opts['clear_caches']
unfi = repo.unfiltered()
x = [None] # used to pass data between closure
@@ -2315,6 +2322,9 @@ def perfbranchmapupdate(ui, repo, base=(
def setup():
x[0] = base.copy()
+ if clearcaches:
+ unfi._revbranchcache = None
+ clearchangelog(repo)
def bench():
x[0].update(targetrepo, newrevs)
More information about the Mercurial-devel
mailing list