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

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 8, 2019, 11:47 a.m.
Message ID <3c1b646e3acdf5386b01.1570535278@nodosa.octobus.net>
Download mbox | patch
Permalink /patch/42105/
State Accepted
Headers show

Comments

Pierre-Yves David - Oct. 8, 2019, 11:47 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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()