This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kj
Recipients Mark.Shannon, kj
Date 2022-01-28.16:36:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643387818.31.0.971991048266.issue46564@roundup.psfhosted.org>
In-reply-to
Content
`super().meth()` is expensive. I propose to optimize 3 parts of this:

1. Avoid creating a temporary super() proxy object.
2. Avoid creating a bound method.
3. Avoid method lookup in super MRO using the inline cache.

Credit for 1. and 2. doesn't belong to me. Those were inspired by the excellent work done in issue43563.

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:

- We don't touch any compiler code.
- This custom instruction isn't revealed to the user
- I can make use of the 5 cache entries shared by both CALL_ADAPTIVE and LOAD_METHOD_ADAPTIVE.

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 https://github.com/faster-cpython/ideas/issues/242 and https://github.com/faster-cpython/ideas/discussions/239 for more info.
History
Date User Action Args
2022-01-28 16:36:58kjsetrecipients: + kj, Mark.Shannon
2022-01-28 16:36:58kjsetmessageid: <1643387818.31.0.971991048266.issue46564@roundup.psfhosted.org>
2022-01-28 16:36:58kjlinkissue46564 messages
2022-01-28 16:36:58kjcreate