Patchwork [5,of,8] perf: add a perfignore command

login
register
mail settings
Submitter Boris Feld
Date Nov. 21, 2018, 6:33 p.m.
Message ID <aeea6de7f1a88e2e710e.1542825235@localhost.localdomain>
Download mbox | patch
Permalink /patch/36703/
State Accepted
Headers show

Comments

Boris Feld - Nov. 21, 2018, 6:33 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@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.
Yuya Nishihara - Nov. 22, 2018, 12:55 p.m.
On Wed, 21 Nov 2018 19:33:55 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@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

In V2, can you add a test to make sure the perf command should at least work?

Patch

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()
 
+@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)