[pypy-svn] r49600 - pypy/dist/pypy/rlib

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Dec 10 15:48:44 CET 2007


Author: cfbolz
Date: Mon Dec 10 15:48:43 2007
New Revision: 49600

Modified:
   pypy/dist/pypy/rlib/rope.py
Log:
don't rebalance recursively


Modified: pypy/dist/pypy/rlib/rope.py
==============================================================================
--- pypy/dist/pypy/rlib/rope.py	(original)
+++ pypy/dist/pypy/rlib/rope.py	Mon Dec 10 15:48:43 2007
@@ -471,7 +471,7 @@
     def _freeze_(self):
         self._calculate()
 
-def concatenate(node1, node2):
+def concatenate(node1, node2, rebalance=True):
     if node1.length() == 0:
         return node2
     if node2.length() == 0:
@@ -485,7 +485,7 @@
                 return BinaryConcatNode(node1.left,
                                         r.literal_concat(node2))
     result = BinaryConcatNode(node1, node2)
-    if result.depth() > MAX_DEPTH: #XXX better check
+    if rebalance and result.depth() > MAX_DEPTH: #XXX better check
         return result.rebalance()
     return result
 
@@ -637,7 +637,7 @@
             # sweep all elements up to the preferred location for 'curr'
             while not (currlen < b and l[empty_up_to] is None):
                 if l[empty_up_to] is not None:
-                    curr = concatenate(l[empty_up_to], curr)
+                    curr = concatenate(l[empty_up_to], curr, rebalance=False)
                     l[empty_up_to] = None
                     currlen = curr.length()
                 else:



More information about the Pypy-commit mailing list