perf: prepare to handle multiple pairs in perfbdiff
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 06 Nov 2016 09:51:14 -0800
changeset 30335 7d91a085ebe6
parent 30334 19d8e19fde5b
child 30336 7ddc8f8d7712
perf: prepare to handle multiple pairs in perfbdiff Before, we only supported benchmarking a single pair of texts with bdiff. We want to enable feeding larger corpora into this benchmark. So rewrite the code to support that.
contrib/perf.py
--- a/contrib/perf.py	Wed Nov 09 22:06:09 2016 +0900
+++ b/contrib/perf.py	Sun Nov 06 09:51:14 2016 -0800
@@ -755,17 +755,18 @@
     elif rev is None:
         raise error.CommandError('perfbdiff', 'invalid arguments')
 
+    textpairs = []
+
     r = cmdutil.openrevlog(repo, 'perfbdiff', file_, opts)
 
     node = r.lookup(rev)
     rev = r.rev(node)
     dp = r.deltaparent(rev)
-
-    text1 = r.revision(dp)
-    text2 = r.revision(node)
+    textpairs.append((r.revision(dp), r.revision(node)))
 
     def d():
-        bdiff.bdiff(text1, text2)
+        for pair in textpairs:
+            bdiff.bdiff(*pair)
 
     timer, fm = gettimer(ui, opts)
     timer(d)