Mercurial > hg-stable
changeset 36393:c25290b98190
perfbranchmap: allow to select the filter to benchmark
Running the branchmap computation on all filter levels can be expensive.
Narrowing the run to some specific filters can speed up benchmarking time when
working only on a subset of filter levels.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 21 Feb 2018 11:43:12 +0100 |
parents | df3f7f00a3fc |
children | a2d11d23bb25 |
files | contrib/perf.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Wed Feb 21 12:13:16 2018 +0100 +++ b/contrib/perf.py Wed Feb 21 11:43:12 2018 +0100 @@ -1568,11 +1568,13 @@ ('', 'clear-revbranch', False, 'purge the revbranch cache between computation'), ] + formatteropts) -def perfbranchmap(ui, repo, full=False, clear_revbranch=False, **opts): +def perfbranchmap(ui, repo, *filternames, **opts): """benchmark the update of a branchmap This benchmarks the full repo.branchmap() call with read and write disabled """ + full = opts.get("full", False) + clear_revbranch = opts.get("clear_revbranch", False) timer, fm = gettimer(ui, opts) def getbranchmap(filtername): """generate a benchmark function for the filtername""" @@ -1591,6 +1593,8 @@ return d # add filter in smaller subset to bigger subset possiblefilters = set(repoview.filtertable) + if filternames: + possiblefilters &= set(filternames) subsettable = getbranchmapsubsettable() allfilters = [] while possiblefilters: @@ -1607,8 +1611,9 @@ if not full: for name in allfilters: repo.filtered(name).branchmap() - # add unfiltered - allfilters.append(None) + if not filternames or 'unfiltered' in filternames: + # add unfiltered + allfilters.append(None) branchcacheread = safeattrsetter(branchmap, 'read') branchcachewrite = safeattrsetter(branchmap.branchcache, 'write')