changeset 30335:7d91a085ebe6

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 06 Nov 2016 09:51:14 -0800
parents 19d8e19fde5b
children 7ddc8f8d7712
files contrib/perf.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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)