Ergonomic ref counting: optimize away clones when possible - #139088
Conversation
| let mir = instance.instantiate_mir_and_normalize_erasing_regions( | ||
| tcx, | ||
| ty::TypingEnv::fully_monomorphized(), | ||
| ty::EarlyBinder::bind(mir.clone()), |
There was a problem hiding this comment.
We need to clone the mir body here, unsure how bad this could be.
There was a problem hiding this comment.
Maybe in order to avoid affecting performance of things that do not involve use, we can just execute this when tcx.features().ergonomic_clones() is on.
This comment has been minimized.
This comment has been minimized.
5592732 to
961717a
Compare
This comment has been minimized.
This comment has been minimized.
961717a to
07cc495
Compare
This comment has been minimized.
This comment has been minimized.
07cc495 to
28551ae
Compare
This comment has been minimized.
This comment has been minimized.
28551ae to
792d2ce
Compare
This comment has been minimized.
This comment has been minimized.
| @@ -1,52 +0,0 @@ | |||
| //@ known-bug: #129372 | |||
There was a problem hiding this comment.
Would need to properly decide exactly what to do with this test. If just removing it is fine or if there's some variation that needs to be placed in tests/ui. Didn't bother to check this for now.
This comment has been minimized.
This comment has been minimized.
0a7a642 to
f6c3c4b
Compare
|
This PR changes a file inside This PR changes MIR cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @vakaras Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
|
(Procedurally, it'd be nice to reference the tracking issue in every PR related to that feature. Makes it much easier to navigate around for someone who's not following every single PR in this project.) |
f6c3c4b to
082b0fa
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (aa03ab8): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking 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 the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -0.4%, secondary -1.4%)This 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.
CyclesResults (secondary 1.8%)This 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 778.658s -> 780.235s (0.20%) |
nikomatsakis
left a comment
There was a problem hiding this comment.
This seems like a good first option until #131650 lands. There are more efficient ways to do this if compilation time becomes an issue later on.
|
@bors r+ |
|
Removed perf regression label as the latest perf run didn't show regressions. Anyway, we are keeping track of potential perf changes. |
|
Scheduling: If the current rollup fails, move on to a never PR instead of an iffy PR. @bors p=1 |
|
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 9d28fe3 (parent) -> 7d7de5b (this PR) Test differencesShow 10 test diffsStage 1
Stage 2
Additionally, 4 doctest diffs were found. These are ignored, as they are noisy. Job group index
Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (7d7de5b): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (secondary -7.3%)This 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 780.245s -> 782.463s (0.28%) |
This PR build on top of #134797. It optimizes codegen of ergonomic ref-counting when the type being
used is only known to be copy after monomorphization. We avoid codening a clone and generate bitwise copy instead.RFC: rust-lang/rfcs#3680
Tracking issue: #132290
Project goal: rust-lang/goals#107
r? @nikomatsakis
This PR could better sit on top of #131650 but as it did not land yet I've decided to just do minimal changes. It may be the case that doing what I'm doing regress the performance and we may need to go the full route of #131650.
cc @saethlin in this regard.