perf: add a no-lookup variant to perfindex
authorBoris Feld <boris.feld@octobus.net>
Fri, 25 Jan 2019 18:43:48 -0500
changeset 41438 e9891c734bf8
parent 41437 d65ba1ff4559
child 41439 7eb7637e34bf
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.
contrib/perf.py
--- 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()