changeset 14066:14fac6c0536a

pure bdiff: don't use a generator Generators are slow, and currently defeat the PyPy JIT.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sat, 30 Apr 2011 15:05:36 +0200
parents 8f7132fa5e59
children e88a4958a6b7
files mercurial/pure/bdiff.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pure/bdiff.py	Sat Apr 30 15:05:34 2011 +0200
+++ b/mercurial/pure/bdiff.py	Sat Apr 30 15:05:36 2011 +0200
@@ -19,6 +19,7 @@
 
 def _normalizeblocks(a, b, blocks):
     prev = None
+    r = []
     for curr in blocks:
         if prev is None:
             prev = curr
@@ -40,9 +41,10 @@
             while (b1end + shift < b2end and
                    a[a1end + shift] == b[b1end + shift]):
                 shift += 1
-        yield a1, b1, l1 + shift
+        r.append((a1, b1, l1 + shift))
         prev = a2 + shift, b2 + shift, l2 - shift
-    yield prev
+    r.append(prev)
+    return r
 
 def bdiff(a, b):
     a = str(a).splitlines(True)