perf: move cache clearing in the `setup` step of `perfheads`
authorBoris Feld <boris.feld@octobus.net>
Fri, 25 Jan 2019 14:53:19 -0500
changeset 41436 ab6d1f82be32
parent 41435 e2e815e3c4ae
child 41437 d65ba1ff4559
perf: move cache clearing in the `setup` step of `perfheads` The cache clearing is pretty fast, but this seems more "correct".
contrib/perf.py
--- a/contrib/perf.py	Fri Jan 25 18:22:02 2019 -0500
+++ b/contrib/perf.py	Fri Jan 25 14:53:19 2019 -0500
@@ -539,10 +539,11 @@
     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+