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.
--- 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
--- a/tests/test-contrib-perf.t Mon Nov 26 15:36:06 2018 +0300
+++ b/tests/test-contrib-perf.t Thu Nov 22 21:00:13 2018 +0100
@@ -86,6 +86,7 @@
perfhelper-pathcopies
find statistic about potential parameters for the
'perftracecopies'
+ perfignore benchmark operation related to computing ignore
perfindex (no help text available)
perflinelogedits
(no help text available)
@@ -166,6 +167,7 @@
fncache already up to date
#endif
$ hg perfheads
+ $ hg perfignore
$ hg perfindex
$ hg perflinelogedits -n 1
$ hg perfloadmarkers