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
bpo-46944: use FASTCALL calling convention in generator.throw #31723
Conversation
@kumaraditya303 Can you provide the benchmark? |
@corona10 import pyperf
runner = pyperf.Runner()
runner.timeit(name="bench throw",
stmt="g.throw(TypeError)",
setup = """
def gen():
while True:
try:
yield
except Exception:
pass
g = gen()
g.send(None)
""") Result: Mean +- std dev: [base] 264 ns +- 12 ns -> [patch] 218 ns +- 12 ns: 1.21x faster |
OOI, why did you choose I don't want to discourage you, I'm just curious. |
I was reading through the generator implementation and noticed that throw does not uses the fastcall calling convention so I created a PR to make it fast. I'll find more function which are worth porting over to fastcall. Thanks for your suggestion. |
If a vararg method looks like Edit: or rather |
Misc/NEWS.d/next/Core and Builtins/2022-03-08-10-50-42.bpo-46944.cnaIK3.rst
Outdated
Show resolved
Hide resolved
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Looks good |
https://bugs.python.org/issue46944