[PATCH 1 of 6 V2] perf: add a perfignore command

Boris Feld boris.feld at octobus.net
Thu Nov 22 22:17:18 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1542916813 -3600
#      Thu Nov 22 21:00:13 2018 +0100
# Node ID 98300756a74d424fcd1510b0bb98f07b9b0f8663
# Parent  efd0f79246e3e6633dfd06226464a48584f69b19
# EXP-Topic perf-ignore-2
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 98300756a74d
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
@@ -961,6 +961,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)
@@ -161,6 +162,7 @@ perfstatus
   fncache already up to date
 #endif
   $ hg perfheads
+  $ hg perfignore
   $ hg perfindex
   $ hg perflinelogedits -n 1
   $ hg perfloadmarkers


More information about the Mercurial-devel mailing list