Patchwork [3,of,7] perf: move cache clearing in the `setup` step of `perfheads`

login
register
mail settings
Submitter Boris Feld
Date Jan. 28, 2019, 8:10 p.m.
Message ID <1e7a5bec6326c537b65f.1548706255@localhost.localdomain>
Download mbox | patch
Permalink /patch/38143/
State Accepted
Headers show

Comments

Boris Feld - Jan. 28, 2019, 8:10 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1548445999 18000
#      Fri Jan 25 14:53:19 2019 -0500
# Node ID 1e7a5bec6326c537b65ffb59b51c4bb34ea189cc
# Parent  dbc0d2061b0584c423f4ecf007cd0125e16b11d1
# EXP-Topic perf-ext
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 1e7a5bec6326
perf: move cache clearing in the `setup` step of `perfheads`

The cache clearing is pretty fast, but this seems more "correct".

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -539,10 +539,11 @@  def perfheads(ui, repo, **opts):
     opts = _byteskwargs(opts)
     timer, fm = gettimer(ui, opts)
     cl = repo.changelog
+    def s():
+        clearcaches(cl)
     def d():
         len(cl.headrevs())
-        clearcaches(cl)
-    timer(d)
+    timer(d, setup=s)
     fm.end()
 
 @command(b'perftags', formatteropts+