[pypy-commit] pypy default: 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.
alex_gaynor
noreply at buildbot.pypy.org
Sun May 15 22:49:52 CEST 2011
Author: Alex Gaynor <alex.gaynor at 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
More information about the pypy-commit
mailing list