[PATCH 05 of 13] perf: use `setup` function in `perfdirstatedirs`
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Oct 8 11:47:52 UTC 2019
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1570514921 14400
# Tue Oct 08 02:08:41 2019 -0400
# Node ID 13417ac3f81259be90354e190b1e0ff8d6f86314
# Parent 902c06177e20872773fb8bab6ca3569412143b08
# EXP-Topic perf-doc
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 13417ac3f812
perf: use `setup` function in `perfdirstatedirs`
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
@@ -1128,13 +1128,15 @@ def perfdirstatedirs(ui, repo, **opts):
"""
opts = _byteskwargs(opts)
timer, fm = gettimer(ui, opts)
- b"a" in repo.dirstate
+ repo.dirstate.hasdir(b"a")
+
+ def setup():
+ del repo.dirstate._map._dirs
def d():
repo.dirstate.hasdir(b"a")
- del repo.dirstate._map._dirs
-
- timer(d)
+
+ timer(d, setup=setup)
fm.end()
More information about the Mercurial-devel
mailing list