[PATCH 5 of 8] perf: add a perfignore command

Boris Feld boris.feld at octobus.net
Wed Nov 21 13:33:55 EST 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1542669732 0
#      Mon Nov 19 23:22:12 2018 +0000
# Node ID aeea6de7f1a88e2e710ee01299fe4fe9e1f0d336
# Parent  ea3a9f11bceef210118fc368908f4cfcd5a814fa
# EXP-Topic perf-ignore
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r aeea6de7f1a8
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.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -960,6 +960,23 @@ def perfchangeset(ui, repo, rev, **opts)
     timer(d)
     fm.end()
 
+ at 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="load")
+    fm.end()
+
 @command(b'perfindex', formatteropts)
 def perfindex(ui, repo, **opts):
     import mercurial.revlog
diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t
--- a/tests/test-contrib-perf.t
+++ b/tests/test-contrib-perf.t
@@ -83,6 +83,7 @@ perfstatus
    perffncachewrite
                  (no help text available)
    perfheads     (no help text available)
+   perfignore    benchmark operation related to computing ignore
    perfindex     (no help text available)
    perflinelogedits
                  (no help text available)


More information about the Mercurial-devel mailing list