Skip to content

GH-145667: Merge GET_ITER and GET_YIELD_FROM_ITER#146120

Open
markshannon wants to merge 3 commits intopython:mainfrom
markshannon:breakup-yield-from-iter
Open

GH-145667: Merge GET_ITER and GET_YIELD_FROM_ITER#146120
markshannon wants to merge 3 commits intopython:mainfrom
markshannon:breakup-yield-from-iter

Conversation

@markshannon
Copy link
Member

@markshannon markshannon commented Mar 18, 2026

Also modifies SEND to make it a bit more like FOR_ITER as both are now fed by GET_ITER.

Apart from saving an opcode, this will enable broadly similar optimizations to be applied to SEND as are already applied to FOR_ITER. Which will be able to:

  • significantly improve the performance of yield from seq where seq is a common iterable, like list.
  • allow the JIT to trace through SEND as it will be mostly specialized.

For now, this is broadly performance neutral, between +0% and -1%, mostly about 0%.

Copy link
Contributor

@diegorusso diegorusso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit

Python 3.15a4 3660 (Change generator preamble code)
Python 3.15a4 3661 (Lazy imports IMPORT_NAME opcode changes)
Python 3.15a6 3662 (Add counter to RESUME)
Python 3.15a8 3662 (Add counter to RESUME)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you change the alpha number?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants