Author: Alex Gaynor <[email protected]>
Branch: python-loop-unroll
Changeset: r64653:0fe85e59b146
Date: 2013-05-28 16:45 -0700
http://bitbucket.org/pypy/pypy/changeset/0fe85e59b146/

Log:    a heuristic, who knows if it works!

diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -879,7 +879,8 @@
     def GET_ITER(self, oparg, next_instr):
         from pypy.module.__pypy__.interp_unroll import W_LoopUnroller
         w_iterable = self.popvalue()
-        if isinstance(w_iterable, W_LoopUnroller):
+        length_hint = self.space.length_hint(w_iterable, sys.maxint)
+        if isinstance(w_iterable, W_LoopUnroller) or 
jit.isconstant(length_hint) and length_hint < 20:
             lastblock = self.lastblock
             # This is the case for comprehensions, which don't add a frame
             # block, annoying (for now ignore the problem).
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to