Author: Alex Gaynor <[email protected]>
Branch: 
Changeset: r45447:40a63caa7c26
Date: 2011-07-09 21:13 -0700
http://bitbucket.org/pypy/pypy/changeset/40a63caa7c26/

Log:    Replace this O(n^2) loop with a simple O(n) library function.

diff --git a/pypy/module/array/interp_array.py 
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -572,10 +572,7 @@
             self.fromsequence(w_ustr)
 
         def array_tounicode__Array(space, self):
-            u = u""
-            for i in range(self.len):
-                u += self.buffer[i]
-            return space.wrap(u)
+            return space.wrap(rffi.wcharpsize2unicode(self.buffer, self.len))
     else:
 
         def array_fromunicode__Array_Unicode(space, self, w_ustr):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to