Author: Alex Gaynor <alex.gay...@gmail.com>
Branch: 
Changeset: r44192:9553faaba615
Date: 2011-05-15 15:58 -0500
http://bitbucket.org/pypy/pypy/changeset/9553faaba615/

Log:    This function is already specialized for single char strings, move
        the rest of the logic to a seperate function so that the JIT inlines
        appropriately.

diff --git a/pypy/objspace/std/stringobject.py 
b/pypy/objspace/std/stringobject.py
--- a/pypy/objspace/std/stringobject.py
+++ b/pypy/objspace/std/stringobject.py
@@ -52,12 +52,16 @@
         c = v[0]
         return space.newbool(fun(c))
     else:
-        for idx in range(len(v)):
-            if not fun(v[idx]):
-                return space.w_False
-        return space.w_True
+        return _is_generic_loop(space, v, fun)
 _is_generic._annspecialcase_ = "specialize:arg(2)"
 
+def _is_generic_loop(space, v, fun):
+    for idx in range(len(v)):
+        if not fun(v[idx]):
+            return space.w_False
+    return space.w_True
+_is_generic_loop._annspecialcase_ = "specialize:arg(2)"
+
 def _upper(ch):
     if ch.islower():
         o = ord(ch) - 32
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to