changeset 41438:e9891c734bf8

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.
author Boris Feld <boris.feld@octobus.net>
date Fri, 25 Jan 2019 18:43:48 -0500
parents d65ba1ff4559
children 7eb7637e34bf
files contrib/perf.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Mon Jan 28 04:47:40 2019 -0500
+++ b/contrib/perf.py	Fri Jan 25 18:43:48 2019 -0500
@@ -1015,6 +1015,7 @@
 
 @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
@@ -1029,7 +1030,9 @@
     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'])
@@ -1044,7 +1047,8 @@
         clearchangelog(unfi)
     def d():
         cl = makecl(unfi)
-        cl.rev(n)
+        if n is not None:
+            cl.rev(n)
     timer(d, setup=setup)
     fm.end()