# HG changeset patch
# User Boris Feld <boris.f...@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".

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+
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to