Patchwork [5,of,7] perf: add a no-lookup variant to perfindex

login
register
mail settings
Submitter Boris Feld
Date Jan. 28, 2019, 8:10 p.m.
Message ID <2518d5acdc4e994193ca.1548706257@localhost.localdomain>
Download mbox | patch
Permalink /patch/38145/
State Accepted
Headers show

Comments

Boris Feld - Jan. 28, 2019, 8:10 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1548459828 18000
#      Fri Jan 25 18:43:48 2019 -0500
# Node ID 2518d5acdc4e994193ca5b70f945983a61e22ff5
# Parent  9a0d513d684855e3fbdd023c1fe84e7bad6579c4
# EXP-Topic perf-ext
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 2518d5acdc4e
perf: add a no-lookup variant to perfindex

It is useful to check how long it takes to create a index object without doing
anything with it. We add a new flag dedicated to that.
Pulkit Goyal - Jan. 28, 2019, 10 p.m.
On Tue, Jan 29, 2019 at 1:49 AM Boris Feld <boris.feld@octobus.net> wrote:

> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1548459828 18000
> #      Fri Jan 25 18:43:48 2019 -0500
> # Node ID 2518d5acdc4e994193ca5b70f945983a61e22ff5
> # Parent  9a0d513d684855e3fbdd023c1fe84e7bad6579c4
> # EXP-Topic perf-ext
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 2518d5acdc4e
> perf: add a no-lookup variant to perfindex
>
> It is useful to check how long it takes to create a index object without
> doing
> anything with it. We add a new flag dedicated to that.
>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -1017,6 +1017,7 @@ def perfignore(ui, repo, **opts):
>
>  @command(b'perfindex', [
>              (b'', b'rev', b'', b'revision to be looked up (default tip)'),
> +            (b'', b'no-lookup', None, b'do not revision lookup post
> creation'),
>           ] + formatteropts)
>  def perfindex(ui, repo, **opts):
>      """benchmark index creation time followed by a lookup
> @@ -1031,7 +1032,9 @@ def perfindex(ui, repo, **opts):
>      opts = _byteskwargs(opts)
>      timer, fm = gettimer(ui, opts)
>      mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
> -    if opts[b'rev'] is None:
> +    if opts[b'no_lookup']:
> +        n = None
> +    elif opts[b'rev'] is None:
>          n = repo[b"tip"].node()
>

We should disallow passing both '--no-lookup' and '--rev'.
Pulkit Goyal - Jan. 28, 2019, 10:01 p.m.
On Tue, Jan 29, 2019 at 3:30 AM Pulkit Goyal <7895pulkit@gmail.com> wrote:

>
>
> On Tue, Jan 29, 2019 at 1:49 AM Boris Feld <boris.feld@octobus.net> wrote:
>
>> # HG changeset patch
>> # User Boris Feld <boris.feld@octobus.net>
>> # Date 1548459828 18000
>> #      Fri Jan 25 18:43:48 2019 -0500
>> # Node ID 2518d5acdc4e994193ca5b70f945983a61e22ff5
>> # Parent  9a0d513d684855e3fbdd023c1fe84e7bad6579c4
>> # EXP-Topic perf-ext
>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
>> 2518d5acdc4e
>> perf: add a no-lookup variant to perfindex
>>
>> It is useful to check how long it takes to create a index object without
>> doing
>> anything with it. We add a new flag dedicated to that.
>>
>> diff --git a/contrib/perf.py b/contrib/perf.py
>> --- a/contrib/perf.py
>> +++ b/contrib/perf.py
>> @@ -1017,6 +1017,7 @@ def perfignore(ui, repo, **opts):
>>
>>  @command(b'perfindex', [
>>              (b'', b'rev', b'', b'revision to be looked up (default
>> tip)'),
>> +            (b'', b'no-lookup', None, b'do not revision lookup post
>> creation'),
>>           ] + formatteropts)
>>  def perfindex(ui, repo, **opts):
>>      """benchmark index creation time followed by a lookup
>> @@ -1031,7 +1032,9 @@ def perfindex(ui, repo, **opts):
>>      opts = _byteskwargs(opts)
>>      timer, fm = gettimer(ui, opts)
>>      mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
>> -    if opts[b'rev'] is None:
>> +    if opts[b'no_lookup']:
>> +        n = None
>> +    elif opts[b'rev'] is None:
>>          n = repo[b"tip"].node()
>>
>
> We should disallow passing both '--no-lookup' and '--rev'.
>

Ignore this. I see you have done that in next patch.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1017,6 +1017,7 @@  def perfignore(ui, repo, **opts):
 
 @command(b'perfindex', [
             (b'', b'rev', b'', b'revision to be looked up (default tip)'),
+            (b'', b'no-lookup', None, b'do not revision lookup post creation'),
          ] + formatteropts)
 def perfindex(ui, repo, **opts):
     """benchmark index creation time followed by a lookup
@@ -1031,7 +1032,9 @@  def perfindex(ui, repo, **opts):
     opts = _byteskwargs(opts)
     timer, fm = gettimer(ui, opts)
     mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
-    if opts[b'rev'] is None:
+    if opts[b'no_lookup']:
+        n = None
+    elif opts[b'rev'] is None:
         n = repo[b"tip"].node()
     else:
         rev = scmutil.revsingle(repo, opts[b'rev'])
@@ -1046,7 +1049,8 @@  def perfindex(ui, repo, **opts):
         clearchangelog(unfi)
     def d():
         cl = makecl(unfi)
-        cl.rev(n)
+        if n is not None:
+            cl.rev(n)
     timer(d, setup=setup)
     fm.end()