[PATCH 03 of 13] perf: use `setup` function in `perfdirstate`
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Oct 8 07:47:50 EDT 2019
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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()
More information about the Mercurial-devel
mailing list