changeset 27073:b9fc042168a4

revsetbenchmarks: support benchmarking changectx loading Many revset consumers construct changectx instances for each returned result. Add support for benchmarking this to our revset benchmark script. In the future, we might want to have some kind of special syntax in the parsed revset files to engage this mode automatically. This would enable us to load changectxs for revsets that do that in the code and would more accurately benchmark what's actually happening. For now, running all revsets with or without changectxs is sufficient.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 21 Nov 2015 15:43:04 -0800
parents e18a9ceade3b
children 78b0c88ab0db
files contrib/revsetbenchmarks.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/revsetbenchmarks.py	Sat Nov 21 15:39:18 2015 -0800
+++ b/contrib/revsetbenchmarks.py	Sat Nov 21 15:43:04 2015 -0800
@@ -53,10 +53,13 @@
     fullcmd += cmd
     return check_output(fullcmd, stderr=STDOUT)
 
-def perf(revset, target=None):
+def perf(revset, target=None, contexts=False):
     """run benchmark for this very revset"""
     try:
-        output = hg(['perfrevset', revset], repo=target)
+        args = ['perfrevset', revset]
+        if contexts:
+            args.append('--contexts')
+        output = hg(args, repo=target)
         return parseoutput(output)
     except CalledProcessError as exc:
         print >> sys.stderr, 'abort: cannot run revset benchmark: %s' % exc.cmd
@@ -238,6 +241,9 @@
                   default=','.join(DEFAULTVARIANTS),
                   help="comma separated list of variant to test "
                        "(eg: plain,min,sorted) (plain = no modification)")
+parser.add_option('', '--contexts',
+                  action='store_true',
+                  help='obtain changectx from results instead of integer revs')
 
 (options, args) = parser.parse_args()
 
@@ -283,7 +289,7 @@
         varres = {}
         for var in variants:
             varrset = applyvariants(rset, var)
-            data = perf(varrset, target=options.repo)
+            data = perf(varrset, target=options.repo, contexts=options.contexts)
             varres[var] = data
         res.append(varres)
         printresult(variants, idx, varres, len(revsets),