Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance for switch in ceval.c when using MSVC #91719

Open
gvanrossum opened this issue Apr 20, 2022 · 0 comments
Open

Improve performance for switch in ceval.c when using MSVC #91719

gvanrossum opened this issue Apr 20, 2022 · 0 comments
Labels
performance type-bug

Comments

@gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Apr 20, 2022

We've received reports of MSVC not generating optimal code, e.g. gh-89279.

One possible improvement would be to get the big switch statement in ceval.c to generate better code. It's been rumored that MSVC will generate essentially a computed goto if all cases are filled.

See my investigations at faster-cpython/ideas#321 (comment)

@gvanrossum gvanrossum added the type-bug label Apr 20, 2022
@AlexWaygood AlexWaygood added the performance label Apr 20, 2022
gvanrossum added a commit that referenced this issue Apr 21, 2022
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 faster-cpython/ideas#321 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance type-bug
Projects
None yet
Development

No branches or pull requests

2 participants