Dynjit inherits the identical semantics from python bytecode, which is using GET_ITER and FOR_ITER to implement loops:
under dynjit, it is identical to
tmp = iter(xs)
while True:
try:
i = next(iter)
except StopIteration:
goto l:
# do some
l:
The key point is, finding a protocol for, switching from pure Python code to optimized code when the types of iter and i got known.
Question: Should we follow the Python loop implementation, i.e., using __iter__? If so, exception check makes it impossible to make a positive enough performance gain. Even if __iter__ is jitted, exception check is still a disaster.
Dynjit inherits the identical semantics from python bytecode, which is using
GET_ITERandFOR_ITERto implement loops:under dynjit, it is identical to
The key point is, finding a protocol for, switching from pure Python code to optimized code when the types of
iterandigot known.Question: Should we follow the Python loop implementation, i.e., using
__iter__? If so, exception check makes it impossible to make a positive enough performance gain. Even if__iter__is jitted, exception check is still a disaster.