Skip to content
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

Merged
merged 1 commit into from
Jan 20, 2024

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Feb 22, 2023

This avoids 2 instances of the destructor of ThinVec<Diagnostic> from being included in execute_job. It also outlines the cold branch in store_side_effects / store_side_effects_for_anon_node.

@rustbot
Copy link
Collaborator

rustbot commented Feb 22, 2023

r? @TaKO8Ki

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 22, 2023
@TaKO8Ki
Copy link
Member

TaKO8Ki commented Feb 24, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 24, 2023
@bors
Copy link
Contributor

bors commented Feb 24, 2023

⌛ Trying commit e0e90b4828a0daf941235ae89d7e6e50a6acb481 with merge 0f61822f04de7a457545a4ba87c45e7a4bc101e1...

@bors
Copy link
Contributor

bors commented Feb 24, 2023

☀️ Try build successful - checks-actions
Build commit: 0f61822f04de7a457545a4ba87c45e7a4bc101e1 (0f61822f04de7a457545a4ba87c45e7a4bc101e1)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0f61822f04de7a457545a4ba87c45e7a4bc101e1): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Benchmarking 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 @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.2% [1.2%, 1.2%] 1
Regressions ❌
(secondary)
2.3% [2.0%, 2.8%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.2% [1.2%, 1.2%] 1

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 24, 2023

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);
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@cjgillot
Copy link
Contributor

The perf results don't show any improvement in instruction count nor bootstrap time. I wonder if this special case is worth it.

@cjgillot cjgillot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 15, 2023
@bors
Copy link
Contributor

bors commented Apr 30, 2023

☔ The latest upstream changes (presumably #109611) made this pull request unmergeable. Please resolve the merge conflicts.

@cjgillot cjgillot assigned cjgillot and unassigned TaKO8Ki Sep 25, 2023
@JohnCSimon
Copy link
Member


@Zoxc
ping from triage - can you post your status on this PR? There hasn't been an update in a few months and you have merge conflicts.

FYI: when a PR is ready for review, send a message containing
@rustbot ready to switch to S-waiting-on-review so the PR is in the reviewer's backlog.

@Zoxc
Copy link
Contributor Author

Zoxc commented Nov 14, 2023

It's blocked on Gankra/thin-vec#46 to make it cleaner.

@rustbot
Copy link
Collaborator

rustbot commented Dec 7, 2023

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@Zoxc
Copy link
Contributor Author

Zoxc commented Dec 7, 2023

I've made the implementation a bit cleaner using has_capacity.

@Zoxc
Copy link
Contributor Author

Zoxc commented Dec 7, 2023

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 7, 2023
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@cjgillot cjgillot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 17, 2023
@Zoxc
Copy link
Contributor Author

Zoxc commented Jan 18, 2024

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 18, 2024
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()
Copy link
Contributor

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.

@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 20, 2024

📌 Commit 862011e has been approved by cjgillot

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 20, 2024
@bors
Copy link
Contributor

bors commented Jan 20, 2024

⌛ Testing commit 862011e with merge 159bdc1...

@bors
Copy link
Contributor

bors commented Jan 20, 2024

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 159bdc1 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 20, 2024
@bors bors merged commit 159bdc1 into rust-lang:master Jan 20, 2024
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 20, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (159bdc1): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

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.

mean range count
Regressions ❌
(primary)
3.0% [2.8%, 3.1%] 2
Regressions ❌
(secondary)
3.0% [2.5%, 3.9%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.7%, -1.3%] 4
All ❌✅ (primary) 3.0% [2.8%, 3.1%] 2

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

Results

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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.5%, -0.4%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-0.5%, -0.4%] 3

Bootstrap: 666.038s -> 665.65s (-0.06%)
Artifact size: 308.34 MiB -> 308.31 MiB (-0.01%)

@rustbot rustbot removed the perf-regression Performance regression. label Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants