New submission from Demur Rumed:

This is a small change to comprehensions pass in their iterable rather than 
calling GET_ITER before CALL_FUNCTION. This makes it so that the compiler never 
generates GET_ITER without following it with FOR_ITER, nor does it generate 
FOR_ITER without preceding it by GET_ITER

This is the standalone portion of a more constructive patch I'm wanting to 
submit: Replace GET_ITER with a FOR_BEGIN which effectively acts as 
GET_ITER/FOR_ITER. Then modify FOR_ITER to replace the JUMP_ABSOLUTE by 
changing it to a JABS instruction which jumps if the iterator does not return 
null. This reduces the bytecode of by 2 bytes for every for loop & reduces the 
dispatch count per loop by 1 (As we merge GET_ITER/FOR_ITER & 
JUMP_ABSOLUTE/FOR_ITER)

----------
components: Interpreter Core
files: gitfit.patch
keywords: patch
messages: 266400
nosy: Demur Rumed
priority: normal
severity: normal
status: open
title: Never have GET_ITER not followed by FOR_ITER
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file43006/gitfit.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27127>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to