Patchwork [05,of,13] perf: add --clear-revlog flag to branchmapload

login
register
mail settings
Submitter Boris Feld
Date Nov. 23, 2018, 2:09 p.m.
Message ID <e72da9d014ba91ee4f2f.1542982141@localhost.localdomain>
Download mbox | patch
Permalink /patch/36734/
State Accepted
Headers show

Comments

Boris Feld - Nov. 23, 2018, 2:09 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1542951152 -3600
#      Fri Nov 23 06:32:32 2018 +0100
# Node ID e72da9d014ba91ee4f2fe620a9646404a64d7484
# Parent  ba101026c80452a9f60b3d574011c7e8773b5a4e
# EXP-Topic perf-branchmap
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r e72da9d014ba
perf: add --clear-revlog flag to branchmapload

Having the changelog index already loaded when loading the branchmap can have a
large impact on performance.

Example runs (large private repository):

hg perfbranchmapload -f base
! wall 0.116722 comb 0.120000 user 0.110000 sys 0.010000 (best of 59)
hg perfbranchmapload -f base --clear-revlogs
! wall 0.258246 comb 0.230000 user 0.220000 sys 0.010000 (best of 31)
Pulkit Goyal - Nov. 23, 2018, 2:53 p.m.
On Fri, Nov 23, 2018 at 5:18 PM Boris Feld <boris.feld@octobus.net> wrote:

> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1542951152 -3600
> #      Fri Nov 23 06:32:32 2018 +0100
> # Node ID e72da9d014ba91ee4f2fe620a9646404a64d7484
> # Parent  ba101026c80452a9f60b3d574011c7e8773b5a4e
> # EXP-Topic perf-branchmap
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> e72da9d014ba
> perf: add --clear-revlog flag to branchmapload
>
> Having the changelog index already loaded when loading the branchmap can
> have a
> large impact on performance.
>
> Example runs (large private repository):
>
> hg perfbranchmapload -f base
> ! wall 0.116722 comb 0.120000 user 0.110000 sys 0.010000 (best of 59)
> hg perfbranchmapload -f base --clear-revlogs
> ! wall 0.258246 comb 0.230000 user 0.220000 sys 0.010000 (best of 31)
>

Queued 1-5, many thanks!

>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -2184,10 +2184,13 @@ def perfbranchmap(ui, repo, *filternames
>  @command(b'perfbranchmapload', [
>       (b'f', b'filter', b'', b'Specify repoview filter'),
>       (b'', b'list', False, b'List brachmap filter caches'),
> +     (b'', b'clear-revlogs', False, 'refresh changelog and manifest'),
>

Added b'' prefix to 'refresh changelog ...' for py3 compatibility.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -2184,10 +2184,13 @@  def perfbranchmap(ui, repo, *filternames
 @command(b'perfbranchmapload', [
      (b'f', b'filter', b'', b'Specify repoview filter'),
      (b'', b'list', False, b'List brachmap filter caches'),
+     (b'', b'clear-revlogs', False, 'refresh changelog and manifest'),
+
     ] + formatteropts)
 def perfbranchmapload(ui, repo, filter=b'', list=False, **opts):
     """benchmark reading the branchmap"""
     opts = _byteskwargs(opts)
+    clearrevlogs = opts[b'clear_revlogs']
 
     if list:
         for name, kind, st in repo.cachevfs.readdir(stat=True):
@@ -2205,9 +2208,12 @@  def perfbranchmapload(ui, repo, filter=b
         raise error.Abort(b'No branchmap cached for %s repo'
                           % (filter or b'unfiltered'))
     timer, fm = gettimer(ui, opts)
+    def setup():
+        if clearrevlogs:
+            clearchangelog(repo)
     def bench():
         branchmap.read(repo)
-    timer(bench)
+    timer(bench, setup=setup)
     fm.end()
 
 @command(b'perfloadmarkers')