-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Implement Debug
for C-like enums with an array
#109615
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
Conversation
r? @oli-obk (rustbot has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit f1021ed with merge 2d011dde8c273334d2eb4442d82a866ca18a0bf3... |
What's the motivation here? Is the generated code expected to be faster and/or more compact? It's possible that LLVM will do some kind of conversion like this anyway, I'd be interested to see the generated code. |
#106884 previously improved perf surprisingly, so I'm interested to see if this has a similar effect, as it shrinks the generated MIR more. |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (2d011dde8c273334d2eb4442d82a866ca18a0bf3): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
Changed to emit
This now works on non- |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 41140f2 with merge cacf0a7b7eccd3ec43e77c76de0b6c250a24de73... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (cacf0a7b7eccd3ec43e77c76de0b6c250a24de73): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
Since there seems not to be much improvement in perf now, and the generated code is roughly equivalent, this probably isn't worth keeping open :/ |
Implement
Debug
for C-like, automatic discriminant,Copy
enums with["A", "B", "C"][*self as usize]
Points to improve:
unsafe
to avoid a needless bounds check in MIR (should be eliminated, but seems a shame to add a redundant branch)Handling enums with an explicitrepr
(currently, onlyCopy
enums workEnum Foo { A = 0, B = 1, C = 2 }
(might not be worth it for the extra complexity)cc @nnethercote