]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-91719: Make MSVC generate somewhat faster switch code (#91718)
authorGuido van Rossum <guido@python.org>
Thu, 21 Apr 2022 18:53:57 +0000 (11:53 -0700)
committerGitHub <noreply@github.com>
Thu, 21 Apr 2022 18:53:57 +0000 (11:53 -0700)
commitf8dc6186d1857a19edd182277a9d78e6d6cc3787
treee85e859c1999d95ce7cc6402068f84efad807e1f
parentd44815cabc0a8d9932df2fa95cb374eadddb7c17
GH-91719: Make MSVC generate somewhat faster switch code (#91718)

Apparently a switch on an 8-bit quantity where all cases are
present generates a more efficient jump (doing only one indexed
memory load instead of two).

So we make opcode and use_tracing uint8_t, and generate a macro
full of extra `case NNN:` lines for all unused opcodes.

See https://github.com/faster-cpython/ideas/issues/321#issuecomment-1103263673
Include/cpython/pystate.h
Include/opcode.h
Python/ceval.c
Tools/scripts/generate_opcode_h.py