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

Boris Feld boris.feld at octobus.net
Mon Jan 28 15:10:57 EST 2019


# HG changeset patch
# User Boris Feld <boris.feld at 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()
     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()
 


More information about the Mercurial-devel mailing list