-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Constant fold enum member initializers. #917
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
Comments
We've talked about this before as something we'd like to do -- the old compiler would do this under an experimental flag and it was nice for a small perf boost. This also would be a necessary first step for a "zero emit" enum that some we had interest in. As a rough outline I'd expect this to support math over |
I think I'll take this on. |
Oops, I've already started working on this one. From: Daniel Rosenwassermailto:[email protected] I think I'll take this on. — |
Oops 😄 - I currently propagate arithmetic ops on constants but not previously declared enums. You're probably farther than me, right? |
covered by #970 |
Consider the following enum definition:
In most cases, JS engines can optimize simple expressions like these. But they can't do much about accesses to
Flags.C
.This prevents JS engines from using a table jump and causes them to fall back on a sequential if/else if implementation for the switch which is all sorts of terrible.
The text was updated successfully, but these errors were encountered: