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.
--- a/contrib/perf.py Tue Oct 08 01:47:35 2019 -0400
+++ b/contrib/perf.py Tue Oct 08 02:08:41 2019 -0400
@@ -1128,13 +1128,15 @@
"""
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()