Repository navigation
Reland debug impl for fieldless enums with concatenated string without using discriminant_value - #162535
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Reland debug impl for fieldless enums with concatenated string without using discriminant_value
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (6ff0c29): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.8%, secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 1.0%, secondary 5.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 4.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 481.923s -> 481.101s (-0.17%) |
|
Replacing |
This comment has been minimized.
This comment has been minimized.
b82923b to
6c15429
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Reland debug impl for fieldless enums with concatenated string without using discriminant_value
This comment has been minimized.
This comment has been minimized.
|
💔 Test for 499edf9 failed: CI. Failed jobs:
|
This comment has been minimized.
This comment has been minimized.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
Reland debug impl for fieldless enums with concatenated string without using discriminant_value
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (3b82c9e): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.6%, secondary -1.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -2.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.1%, secondary 3.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 485.904s -> 487.919s (0.41%) |
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
This reduces compile time for large enums. Co-authored-by: Makai <m4kai410@gmail.com>
This derive is only used for large nums, so it doesn't make sense to use small enum as an example
11200f7 to
0076e09
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
rebased @rustbot ready |
|
@bors r+ |
Rollup of 6 pull requests Successful merges: - #162535 (Reland debug impl for fieldless enums with concatenated string without using discriminant_value) - #164060 (Add hightlight to acceptable characters in macro rules) - #164583 (Run -Cpasses during OptimizerLastEP) - #164293 (Tweak missing fields error wording) - #164563 (Removes unwanted backticks from slice::as_ascii documentation.) - #164683 (Add -Zasync-panic flag)
Rollup merge of #162535 - panstromek:reland-debug-opt, r=nnethercote Reland debug impl for fieldless enums with concatenated string without using discriminant_value relands part of #155452 partially reverts #162164 fixes only a part of #133945 This implementation avoids the problem in the original PR by using simple match instead of indexing by `discriminant_value`. This avoids the cost of many small strings, generates less MIR and reduces borrowck cost, but it doesn't avoid the match checking costs (obviously). It uses slightly different strategy to avoid more MIR costs - it doesn't generate array of indexes. It maps the enum variant directly to the start index. Names are separated by space, so the outlined function figures out the end index based on that. Some more measurements and reasoning behind this implementation is in [this comment](#162535 (comment)) This PR history contains various experiments, #162535 (comment) is the perf run for the final version, which also includes results for the `enum-stress`, which is a benchmark that contains a stress test for this case. I also noticed there's not really a test testing the output of some of these derives (especially big ones), so I added a case to an existing test that covers this.
|
Note This PR was benchmarked as part of triage of its containing rollup: triage URL. Finished benchmarking commit (fd1f60f): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -60.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -14.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Artifact size: 406.53 MiB -> 406.31 MiB (-0.05%) |
View all comments
relands part of #155452
partially reverts #162164
fixes only a part of #133945
This implementation avoids the problem in the original PR by using simple match instead of indexing by
discriminant_value. This avoids the cost of many small strings, generates less MIR and reduces borrowck cost, but it doesn't avoid the match checking costs (obviously).It uses slightly different strategy to avoid more MIR costs - it doesn't generate array of indexes. It maps the enum variant directly to the start index. Names are separated by space, so the outlined function figures out the end index based on that.
Some more measurements and reasoning behind this implementation is in this comment
This PR history contains various experiments, #162535 (comment) is the perf run for the final version, which also includes results for the
enum-stress, which is a benchmark that contains a stress test for this case.I also noticed there's not really a test testing the output of some of these derives (especially big ones), so I added a case to an existing test that covers this.