Author: Lukas Diekmann <lukas.diekm...@uni-duesseldorf.de>
Branch: list-strategies
Changeset: r47714:d79089a32b7e
Date: 2011-09-30 15:16 +0200
http://bitbucket.org/pypy/pypy/changeset/d79089a32b7e/

Log:    unroll get_strategy_from_objects if the list is constant and small

diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -9,7 +9,7 @@
 from pypy.interpreter import gateway, baseobjspace
 from pypy.rlib.objectmodel import instantiate, specialize
 from pypy.rlib.listsort import make_timsort_class
-from pypy.rlib import rerased
+from pypy.rlib import rerased, jit
 from pypy.interpreter.argument import Signature
 
 def make_range_list(space, start, step, length):
@@ -26,6 +26,7 @@
     storage = strategy.erase(None)
     return W_ListObject.from_storage_and_strategy(space, storage, strategy)
 
+@jit.look_inside_iff(lambda space, list_w: jit.isconstant(len(list_w)) and 
len(list_w) < 5)
 def get_strategy_from_list_objects(space, list_w):
     if not list_w:
         return space.fromcache(EmptyListStrategy)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to