Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable specialization of iteration over generators, for gen():, and awaiting coroutines, await coro() #96793

Open
1 of 5 tasks
markshannon opened this issue Sep 13, 2022 · 0 comments
Labels
performance Performance or resource usage

Comments

@markshannon
Copy link
Member

markshannon commented Sep 13, 2022

We want to be able to specialize iteration over generators and awaiting coroutines. Both for PEP 659 and for higher tier optimizers.

For the theory see faster-cpython/ideas#457

To do this we need:

  • Shim frames to keep the various returns simple GH-96421: Insert shim frame on entry to interpreter #96319
  • Modify FOR_ITER to leave a value on the stack when exiting.
  • Add a GEN_RETURN_VALUE instruction to allow the return instruction to clean up the frame.
  • Implement specialization of FOR_ITER for generators
  • Implement specialization of SEND for coroutines
@markshannon markshannon added the performance Performance or resource usage label Sep 13, 2022
markshannon added a commit that referenced this issue Oct 27, 2022
…H-96801)

Change FOR_ITER to have the same stack effect regardless of whether it branches or not.
Performance is unchanged as FOR_ITER (and specialized forms jump over the cleanup code).
Labels
performance Performance or resource usage
Projects
None yet
Development

No branches or pull requests

1 participant