[pypy-commit] pypy python-loop-unroll: a heuristic, who knows if it works!
alex_gaynor
noreply at buildbot.pypy.org
Wed May 29 01:45:42 CEST 2013
Author: Alex Gaynor <alex.gaynor at gmail.com>
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).
More information about the pypy-commit
mailing list