Patchwork [4,of,5] perf: add a `clear-revlogs` flag to `perfbookmarks`

login
register
mail settings
Submitter Boris Feld
Date Nov. 20, 2018, 7:18 p.m.
Message ID <1799103c7a6fb140cdb7.1542741488@localhost.localdomain>
Download mbox | patch
Permalink /patch/36675/
State Accepted
Headers show

Comments

Boris Feld - Nov. 20, 2018, 7:18 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1542711320 0
#      Tue Nov 20 10:55:20 2018 +0000
# Node ID 1799103c7a6fb140cdb7317c3e7b7cf93295edd0
# Parent  1ad7353bec2584a53f2bb4fbca44310fa827f2d0
# EXP-Topic perf-tags
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 1799103c7a6f
perf: add a `clear-revlogs` flag to `perfbookmarks`

This flag (off by default) makes it possible to enable the refresh of the
changelog and revlog. This is useful to check for costly side effects of
bookmark loading.

Usually, these side effects are shared with other logics (eg: tags).

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -579,13 +579,20 @@  def perfancestorset(ui, repo, revset, **
     timer(d)
     fm.end()
 
-@command(b'perfbookmarks', formatteropts)
+@command(b'perfbookmarks', formatteropts +
+        [
+            (b'', b'clear-revlogs', False, 'refresh changelog and manifest'),
+        ])
 def perfbookmarks(ui, repo, **opts):
     """benchmark parsing bookmarks from disk to memory"""
     opts = _byteskwargs(opts)
     timer, fm = gettimer(ui, opts)
 
+    svfs = getsvfs(repo)
+    clearrevlogs = opts['clear_revlogs']
     def s():
+        if clearrevlogs:
+            repo.changelog = mercurial.changelog.changelog(svfs)
         clearfilecache(repo, b'_bookmarks')
     def d():
         repo._bookmarks