You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Near zero-cost super().meth() calls via adaptive superinstructions #90722
I was reading typeobject.c and noticed that creating a super object currently requires creating a frame object which is created lazily and is slow and it would work with the InterpreterFrame as well so I created a PR for this optimization and now it does not requires creating frame objects.
Oh, I didn't see your PR and commented as it was not mentioned in this bpo.
No problem. In the future please check the "Pull Requests" section on the issue. People don't always say "I created a PR at xxx". Often times we just link the PR into the issue itself.
Keep your PR around in case mine gets rejected, then we can take just the good parts. If mine's accepted, we can close yours.
Activity
Fidget-Spinner commentedon Jan 28, 2022
super().meth()is expensive. I propose to optimize 3 parts of this:Credit for 1. and 2. doesn't belong to me. Those were inspired by the excellent work done in bpo-43563.
I'll do this by combining the adjacent CALL (super) and LOAD_METHOD instructions into CALL_NO_KW_SUPER__LOAD_METHOD. Using the specializer means:
The final 2-argument super(type, obj).meth() form will have almost no overhead over a corresponding self.meth() call in the current implementation.
Please see faster-cpython/ideas#242 and faster-cpython/ideas#239 for more info.
kumaraditya303 commentedon Jan 29, 2022
I was reading typeobject.c and noticed that creating a super object currently requires creating a frame object which is created lazily and is slow and it would work with the InterpreterFrame as well so I created a PR for this optimization and now it does not requires creating frame objects.
Fidget-Spinner commentedon Jan 29, 2022
@Kumar, my PR already has your changes.
kumaraditya303 commentedon Jan 29, 2022
Oh, I didn't see your PR and commented as it was not mentioned in this bpo. Would you like to split the PR or continue with yours, either way is fine?
Fidget-Spinner commentedon Jan 29, 2022
No problem. In the future please check the "Pull Requests" section on the issue. People don't always say "I created a PR at xxx". Often times we just link the PR into the issue itself.
Keep your PR around in case mine gets rejected, then we can take just the good parts. If mine's accepted, we can close yours.
Fidget-Spinner commentedon Feb 1, 2022
New changeset b9ebde8 by Kumar Aditya in branch 'main':
bpo-46564: do not create frame object for super object (GH-31002)
b9ebde8
Fidget-Spinner commentedon Apr 27, 2023
Superseded by #87729.