New submission from Ken Jin <kenjin4...@gmail.com>:
`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. ---------- assignee: kj components: Interpreter Core messages: 412005 nosy: Mark.Shannon, kj priority: normal severity: normal status: open title: Near zero-cost super().meth() calls via adaptive superinstructions type: performance versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46564> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com