Mercurial > hg-stable
changeset 43124:100e7e0cdaad
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.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 08 Oct 2019 02:08:41 -0400 |
parents | 69301b79fd36 |
children | 56494a2bfe2f |
files | contrib/perf.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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()