-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Avoid code generation for ThinVec<Diagnostic>'s destructor in the query system #108359
Conversation
r? @TaKO8Ki (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 e0e90b4828a0daf941235ae89d7e6e50a6acb481 with merge 0f61822f04de7a457545a4ba87c45e7a4bc101e1... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (0f61822f04de7a457545a4ba87c45e7a4bc101e1): comparison URL. Overall result: ❌ regressions - 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)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. |
|
||
if std::intrinsics::unlikely(!side_effects.is_empty()) { | ||
if Q::ANON { | ||
qcx.store_side_effects_for_anon_node(dep_node_index, side_effects); | ||
} else { | ||
qcx.store_side_effects(dep_node_index, side_effects); | ||
} | ||
} else { | ||
// Avoid generating code for the destructor here | ||
mem::forget(side_effects); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a comment to explain why it's not a memory leak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
e0e90b4
to
cfa18e5
Compare
The perf results don't show any improvement in instruction count nor bootstrap time. I wonder if this special case is worth it. |
☔ The latest upstream changes (presumably #109611) made this pull request unmergeable. Please resolve the merge conflicts. |
@Zoxc FYI: when a PR is ready for review, send a message containing |
It's blocked on Gankra/thin-vec#46 to make it cleaner. |
cfa18e5
to
adef9e7
Compare
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
I've made the implementation a bit cleaner using |
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
adef9e7
to
5dad014
Compare
This comment has been minimized.
This comment has been minimized.
5dad014
to
53cf215
Compare
@rustbot ready |
pub fn maybe_any(&self) -> bool { | ||
// Use `has_capacity` so that the destructor for `self.diagnostics` can be skipped | ||
// if `maybe_any` is known to be false. | ||
self.diagnostics.has_capacity() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you keep the destructuring assignment? That's a good way to ensure we don't forget anything in a refactor.
53cf215
to
862011e
Compare
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (159bdc1): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResultsThis 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.
Bootstrap: 666.038s -> 665.65s (-0.06%) |
This avoids 2 instances of the destructor of
ThinVec<Diagnostic>
from being included inexecute_job
. It also outlines the cold branch instore_side_effects
/store_side_effects_for_anon_node
.