Mercurial > public > mercurial-scm > hg-stable
diff contrib/perf.py @ 40784:45a0047c0ebc
perf: add a perfignore command
The command is meant to benchmark operations related to hgignore. Right now the
command is benchmarking the loading time of the hgignore rules.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 22 Nov 2018 21:00:13 +0100 |
parents | 380a1f73830f |
children | f723014677a5 |
line wrap: on
line diff
--- a/contrib/perf.py Mon Nov 26 15:36:06 2018 +0300 +++ b/contrib/perf.py Thu Nov 22 21:00:13 2018 +0100 @@ -975,6 +975,23 @@ timer(d) fm.end() +@command(b'perfignore', formatteropts) +def perfignore(ui, repo, **opts): + """benchmark operation related to computing ignore""" + opts = _byteskwargs(opts) + timer, fm = gettimer(ui, opts) + dirstate = repo.dirstate + + def setupone(): + dirstate.invalidate() + clearfilecache(dirstate, b'_ignore') + + def runone(): + dirstate._ignore + + timer(runone, setup=setupone, title=b"load") + fm.end() + @command(b'perfindex', formatteropts) def perfindex(ui, repo, **opts): import mercurial.revlog