Patchwork [STABLE] perf: add a way to benchmark `dirstate.status`

login
register
mail settings
Submitter Pierre-Yves David
Date Nov. 4, 2019, 10:15 a.m.
Message ID <618ae1b4dcbacbc379a4.1572862521@nodosa.octobus.net>
Download mbox | patch
Permalink /patch/42708/
State Accepted
Headers show

Comments

Pierre-Yves David - Nov. 4, 2019, 10:15 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1572823004 -3600
#      Mon Nov 04 00:16:44 2019 +0100
# Branch stable
# Node ID 618ae1b4dcbacbc379a4ec96b7391876b6503e86
# Parent  c2c3ee8794dd3749f2053555250576039cb2f1f4
# EXP-Topic bench-status
# Available At https://dev.heptapod.net/octobus/mercurial-devel/
#              hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r 618ae1b4dcba
perf: add a way to benchmark `dirstate.status`

Getting more details about time spend in this specific internal bit is
meaningful.
Pulkit Goyal - Nov. 4, 2019, 10:29 a.m.
On Mon, Nov 4, 2019 at 1:24 PM Pierre-Yves David
<pierre-yves.david@ens-lyon.org> wrote:
>
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1572823004 -3600
> #      Mon Nov 04 00:16:44 2019 +0100
> # Branch stable
> # Node ID 618ae1b4dcbacbc379a4ec96b7391876b6503e86
> # Parent  c2c3ee8794dd3749f2053555250576039cb2f1f4
> # EXP-Topic bench-status
> # Available At https://dev.heptapod.net/octobus/mercurial-devel/
> #              hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r 618ae1b4dcba
> perf: add a way to benchmark `dirstate.status`
>
> Getting more details about time spend in this specific internal bit is
> meaningful.

Hm, is this patch really for stable branch of the you misfired?
Pulkit Goyal - Nov. 4, 2019, 10:29 a.m.
On Mon, Nov 4, 2019 at 1:29 PM Pulkit Goyal <7895pulkit@gmail.com> wrote:
>
> On Mon, Nov 4, 2019 at 1:24 PM Pierre-Yves David
> <pierre-yves.david@ens-lyon.org> wrote:
> >
> > # HG changeset patch
> > # User Pierre-Yves David <pierre-yves.david@octobus.net>
> > # Date 1572823004 -3600
> > #      Mon Nov 04 00:16:44 2019 +0100
> > # Branch stable
> > # Node ID 618ae1b4dcbacbc379a4ec96b7391876b6503e86
> > # Parent  c2c3ee8794dd3749f2053555250576039cb2f1f4
> > # EXP-Topic bench-status
> > # Available At https://dev.heptapod.net/octobus/mercurial-devel/
> > #              hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r 618ae1b4dcba
> > perf: add a way to benchmark `dirstate.status`
> >
> > Getting more details about time spend in this specific internal bit is
> > meaningful.
>
> Hm, is this patch really for stable branch of the you misfired?
s/of/or
Pierre-Yves David - Nov. 4, 2019, 10:33 a.m.
On 11/4/19 11:29 AM, Pulkit Goyal wrote:
> On Mon, Nov 4, 2019 at 1:29 PM Pulkit Goyal <7895pulkit@gmail.com> wrote:
>>
>> On Mon, Nov 4, 2019 at 1:24 PM Pierre-Yves David
>> <pierre-yves.david@ens-lyon.org> wrote:
>>>
>>> # HG changeset patch
>>> # User Pierre-Yves David <pierre-yves.david@octobus.net>
>>> # Date 1572823004 -3600
>>> #      Mon Nov 04 00:16:44 2019 +0100
>>> # Branch stable
>>> # Node ID 618ae1b4dcbacbc379a4ec96b7391876b6503e86
>>> # Parent  c2c3ee8794dd3749f2053555250576039cb2f1f4
>>> # EXP-Topic bench-status
>>> # Available At https://dev.heptapod.net/octobus/mercurial-devel/
>>> #              hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r 618ae1b4dcba
>>> perf: add a way to benchmark `dirstate.status`
>>>
>>> Getting more details about time spend in this specific internal bit is
>>> meaningful.
>>
>> Hm, is this patch really for stable branch of the you misfired?
> s/of/or

This patch is low risk and the faster it get publish, the faster I can 
start gathering for it. So I am trying my luck in at the fringe of the 
stable/free area. In practice It can land on either default or stable.
Yuya Nishihara - Nov. 4, 2019, 1:34 p.m.
On Mon, 4 Nov 2019 11:33:48 +0100, Pierre-Yves David wrote:
> On 11/4/19 11:29 AM, Pulkit Goyal wrote:
> > On Mon, Nov 4, 2019 at 1:29 PM Pulkit Goyal <7895pulkit@gmail.com> wrote:
> >>
> >> On Mon, Nov 4, 2019 at 1:24 PM Pierre-Yves David
> >> <pierre-yves.david@ens-lyon.org> wrote:
> >>>
> >>> # HG changeset patch
> >>> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> >>> # Date 1572823004 -3600
> >>> #      Mon Nov 04 00:16:44 2019 +0100
> >>> # Branch stable
> >>> # Node ID 618ae1b4dcbacbc379a4ec96b7391876b6503e86
> >>> # Parent  c2c3ee8794dd3749f2053555250576039cb2f1f4
> >>> # EXP-Topic bench-status
> >>> # Available At https://dev.heptapod.net/octobus/mercurial-devel/
> >>> #              hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r 618ae1b4dcba
> >>> perf: add a way to benchmark `dirstate.status`
> >>>
> >>> Getting more details about time spend in this specific internal bit is
> >>> meaningful.
> >>
> >> Hm, is this patch really for stable branch of the you misfired?
> > s/of/or
> 
> This patch is low risk and the faster it get publish, the faster I can 
> start gathering for it. So I am trying my luck in at the fringe of the 
> stable/free area. In practice It can land on either default or stable.

Queued for default, thanks. It should be better to reduce the load of the
stable stack.
Pierre-Yves David - Nov. 4, 2019, 1:53 p.m.
On 11/4/19 2:34 PM, Yuya Nishihara wrote:
> On Mon, 4 Nov 2019 11:33:48 +0100, Pierre-Yves David wrote:
>> On 11/4/19 11:29 AM, Pulkit Goyal wrote:
>>> On Mon, Nov 4, 2019 at 1:29 PM Pulkit Goyal <7895pulkit@gmail.com> wrote:
>>>>
>>>> On Mon, Nov 4, 2019 at 1:24 PM Pierre-Yves David
>>>> <pierre-yves.david@ens-lyon.org> wrote:
>>>>>
>>>>> # HG changeset patch
>>>>> # User Pierre-Yves David <pierre-yves.david@octobus.net>
>>>>> # Date 1572823004 -3600
>>>>> #      Mon Nov 04 00:16:44 2019 +0100
>>>>> # Branch stable
>>>>> # Node ID 618ae1b4dcbacbc379a4ec96b7391876b6503e86
>>>>> # Parent  c2c3ee8794dd3749f2053555250576039cb2f1f4
>>>>> # EXP-Topic bench-status
>>>>> # Available At https://dev.heptapod.net/octobus/mercurial-devel/
>>>>> #              hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r 618ae1b4dcba
>>>>> perf: add a way to benchmark `dirstate.status`
>>>>>
>>>>> Getting more details about time spend in this specific internal bit is
>>>>> meaningful.
>>>>
>>>> Hm, is this patch really for stable branch of the you misfired?
>>> s/of/or
>>
>> This patch is low risk and the faster it get publish, the faster I can
>> start gathering for it. So I am trying my luck in at the fringe of the
>> stable/free area. In practice It can land on either default or stable.
> 
> Queued for default, thanks. It should be better to reduce the load of the
> stable stack.

noted, thanks.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -760,7 +760,10 @@  def perfannotate(ui, repo, f, **opts):
 
 @command(
     b'perfstatus',
-    [(b'u', b'unknown', False, b'ask status to look for unknown files')]
+    [
+        (b'u', b'unknown', False, b'ask status to look for unknown files'),
+        (b'', b'dirstate', False, b'benchmark the internal dirstate call'),
+    ]
     + formatteropts,
 )
 def perfstatus(ui, repo, **opts):
@@ -776,7 +779,20 @@  def perfstatus(ui, repo, **opts):
     # timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False,
     #                                                False))))
     timer, fm = gettimer(ui, opts)
-    timer(lambda: sum(map(len, repo.status(unknown=opts[b'unknown']))))
+    if opts[b'dirstate']:
+        dirstate = repo.dirstate
+        m = scmutil.matchall(repo)
+        unknown = opts[b'unknown']
+
+        def status_dirstate():
+            s = dirstate.status(
+                m, subrepos=[], ignored=False, clean=False, unknown=unknown
+            )
+            sum(map(len, s))
+
+        timer(status_dirstate)
+    else:
+        timer(lambda: sum(map(len, repo.status(unknown=opts[b'unknown']))))
     fm.end()
 
 
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
@@ -248,6 +248,7 @@  perfstatus
   $ hg perfrevset 'all()'
   $ hg perfstartup
   $ hg perfstatus
+  $ hg perfstatus --dirstate
   $ hg perftags
   $ hg perftemplating
   $ hg perfvolatilesets