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

login
register
mail settings
Submitter Boris Feld
Date Nov. 20, 2018, 7:18 p.m.
Message ID <7760b12bd4fb467f4fb7.1542741486@localhost.localdomain>
Download mbox | patch
Permalink /patch/36672/
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 1542710780 0
#      Tue Nov 20 10:46:20 2018 +0000
# Node ID 7760b12bd4fb467f4fb7e4d0d5094fc324f30f49
# Parent  4ea6bac93535a7b6f69df014f738a45104bab934
# EXP-Topic perf-tags
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 7760b12bd4fb
perf: add a `clear-revlogs` flag to `perftags`

This flag (on by default) makes it possible to disable the refresh of the
changelog and revlog. This is useful to check for the time spent in the core
tags logic without the associated side effects. Usually, these side effects
are shared with other logics (eg: bookmarks).

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -530,7 +530,10 @@  def perfheads(ui, repo, **opts):
     timer(d)
     fm.end()
 
-@command(b'perftags', formatteropts)
+@command(b'perftags', formatteropts+
+        [
+            (b'', b'clear-revlogs', True, 'refresh changelog and manifest'),
+        ])
 def perftags(ui, repo, **opts):
     import mercurial.changelog
     import mercurial.manifest
@@ -539,11 +542,13 @@  def perftags(ui, repo, **opts):
     timer, fm = gettimer(ui, opts)
     svfs = getsvfs(repo)
     repocleartagscache = repocleartagscachefunc(repo)
+    clearrevlogs = opts['clear_revlogs']
     def s():
-        repo.changelog = mercurial.changelog.changelog(svfs)
-        rootmanifest = mercurial.manifest.manifestrevlog(svfs)
-        repo.manifestlog = mercurial.manifest.manifestlog(svfs, repo,
-                                                          rootmanifest)
+        if clearrevlogs:
+            repo.changelog = mercurial.changelog.changelog(svfs)
+            rootmanifest = mercurial.manifest.manifestrevlog(svfs)
+            repo.manifestlog = mercurial.manifest.manifestlog(svfs, repo,
+                                                              rootmanifest)
         repocleartagscache()
     def t():
         return len(repo.tags())