X Tutup
The Wayback Machine - https://web.archive.org/web/20230117140126/https://github.com/python/cpython/pull/101013
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

GH-100762: Don't call gen.throw() in gen.close(), unless necessary. #101013

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Jan 13, 2023

Change oparg of YIELD_VALUE to hold the exception handler depth.
We can then test that in gen.close() to avoid calling gen.throw() unless necessary.

@markshannon
Copy link
Member Author

markshannon commented Jan 13, 2023

Using the benchmarks in #101011 (comment), but using timeit instead of pyperf and a non-pgo and no-lto build because I'm impatient.
I get no significant change on "comprehension", "generator exhaust", and "all", but runtime is about 60% for "generator" and "all with comparison"

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.

None yet

2 participants
X Tutup