[pypy-commit] pypy refactor-str-types: (antocuni, mjacob): add a fastpath for strings, trying to fix the slowdown that we observe in things like unicode_string+byte_string

antocuni noreply at buildbot.pypy.org
Fri Jan 17 00:29:42 CET 2014


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: refactor-str-types
Changeset: r68703:ec53889e6f05
Date: 2014-01-17 00:29 +0100
http://bitbucket.org/pypy/pypy/changeset/ec53889e6f05/

Log:	(antocuni, mjacob): add a fastpath for strings, trying to fix the
	slowdown that we observe in things like unicode_string+byte_string

diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -88,6 +88,8 @@
     def _op_val(self, space, w_other):
         if isinstance(w_other, W_UnicodeObject):
             return w_other._value
+        if space.isinstance_w(w_other, space.w_str):
+            return unicode_from_string(space, w_other)._value
         return unicode_from_encoded_object(space, w_other, None, "strict")._value
 
     def _chr(self, char):


More information about the pypy-commit mailing list