Skip checked enum inits in cycle() hot path - #891
Open
natecook1000 wants to merge 1 commit into
Open
natecook1000 wants to merge 1 commit into
natecook1000 wants to merge 1 commit into
Conversation
The generated checked initializers for raw representable enums are too big to be inlined into the large `cycle()` function. Since the only values used in `cycle()` are raw values generated from cases in the first place, and these enums have raw case values that match the enum tag, it's safe to bitcast from the raw value to the enum type instead. This change adds a function to convert a raw value to an enum case, asserting in debug mode if the constructed case is invalid.
natecook1000
force-pushed
the
perf/simplify-cycle
branch
from
October 2, 2026 19:09
5a5c096 to
9b0cd8c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The generated checked initializers for raw representable enums are too big to be inlined into the large
cycle()function. Since the only values used incycle()are raw values generated from cases in the first place, and these enums have raw case values that match the enum tag, it's safe to bitcast from the raw value to the enum type instead.This change adds a function to convert a raw value to an enum case, asserting in debug mode if the constructed case is invalid.