[PATCH 11 of 13] perf: use `setup` function in `perfdirstatewrite`

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Oct 8 07:47:58 EDT 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1570515544 14400
#      Tue Oct 08 02:19:04 2019 -0400
# Node ID 3c1b646e3acdf5386b01a010e66bd102dbbb90e4
# Parent  1c51d61bbe6899cc5baeb20de5539f922710e5a1
# EXP-Topic perf-doc
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 3c1b646e3acd
perf: use `setup` function in `perfdirstatewrite`

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
@@ -1192,11 +1192,13 @@ def perfdirstatewrite(ui, repo, **opts):
     ds = repo.dirstate
     b"a" in ds
 
+    def setup():
+        ds._dirty = True
+
     def d():
-        ds._dirty = True
         ds.write(repo.currenttransaction())
 
-    timer(d)
+    timer(d, setup=setup)
     fm.end()
 
 


More information about the Mercurial-devel mailing list