# HG changeset patch
# User Pierre-Yves David <pierre-yves.da...@octobus.net>
# Date 1570514230 14400
#      Tue Oct 08 01:57:10 2019 -0400
# Node ID 574a82b6c9e77c1ffd3e69d0649b720945b182c6
# Parent  ec08340eaebb19b13d9544616ac232cba7cd4e12
# EXP-Topic perf-doc
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
574a82b6c9e7
perf: use `setup` function in `perfdirstate`

The command seems to pre-date the introduction of the `setup` support in timer.
We move the line that is obviously about benchmark setup in such `setup`
function.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1112,11 +1112,13 @@ def perfdirstate(ui, repo, **opts):
     timer, fm = gettimer(ui, opts)
     b"a" in repo.dirstate
 
+    def setup():
+        repo.dirstate.invalidate()
+
     def d():
-        repo.dirstate.invalidate()
         b"a" in repo.dirstate
 
-    timer(d)
+    timer(d, setup=setup)
     fm.end()
 
 
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to