]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)
authorCarl Meyer <carl@oddbird.net>
Mon, 24 Apr 2023 22:22:14 +0000 (16:22 -0600)
committerGitHub <noreply@github.com>
Mon, 24 Apr 2023 22:22:14 +0000 (22:22 +0000)
commit0dc8b50d33208e9ca4fc3d959c6798529731f020
tree822102a5177183fc6ad7075bd74a02a5633edc52
parent22bed58e531ce780d91f3364c5ace98fad28c2e8
gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)

This speeds up `super()` (by around 85%, for a simple one-level
`super().meth()` microbenchmark) by avoiding allocation of a new
single-use `super()` object on each use.
18 files changed:
Doc/library/dis.rst
Include/internal/pycore_opcode.h
Include/internal/pycore_typeobject.h
Include/opcode.h
Lib/dis.py
Lib/importlib/_bootstrap_external.py
Lib/opcode.py
Lib/test/shadowed_super.py [new file with mode: 0644]
Lib/test/test_gdb.py
Lib/test/test_super.py
Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst [new file with mode: 0644]
Objects/typeobject.c
Python/bytecodes.c
Python/ceval.c
Python/compile.c
Python/generated_cases.c.h
Python/opcode_metadata.h
Python/opcode_targets.h