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.
--- 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)