[pypy-commit] pypy set-strategies: little changes to make the jit inline more stuff and optimize the trace

l.diekmann noreply at buildbot.pypy.org
Thu Jan 12 18:23:46 CET 2012


Author: l.diekmann
Branch: set-strategies
Changeset: r51289:93d68d35cc81
Date: 2012-01-12 17:23 +0000
http://bitbucket.org/pypy/pypy/changeset/93d68d35cc81/

Log:	little changes to make the jit inline more stuff and optimize the
	trace

diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -943,8 +943,9 @@
         w_set.sstorage = strategy.get_empty_storage()
         return
 
-    #XXX check ints and strings at once
+    _pick_correct_strategy(space, w_set, iterable_w)
 
+def _pick_correct_strategy(space, w_set, iterable_w):
     # check for integers
     for w_item in iterable_w:
         if type(w_item) is not W_IntObject:
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
@@ -61,7 +61,12 @@
         return plain_str2unicode(space, w_self._value)
 
     def listview_str(w_self):
-        return [s for s in w_self._value]
+        return _create_list_from_string(w_self._value)
+
+def _create_list_from_string(value):
+    # need this helper function to allow the jit to look inside and inline
+    # listview_str
+    return [s for s in value]
 
 registerimplementation(W_StringObject)
 


More information about the pypy-commit mailing list