Skip to content

cstore: Use IndexSet as backing store for postorder dependencies #141730

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

Merged

Conversation

osiewicz
Copy link
Contributor

@osiewicz osiewicz commented May 29, 2025

<rustc_metadata::creader::CStore>::push_dependencies_in_postorder showed up in new benchmarks from rust-lang/rustc-perf#2143, hence I gave it a shot to remove an obvious O(n) there.

r? nnethercote

@rustbot rustbot added 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 May 29, 2025
@rust-log-analyzer

This comment has been minimized.

@bjorn3
Copy link
Member

bjorn3 commented May 29, 2025

@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 May 29, 2025
<rustc_metadata::creader::CStore>::push_dependencies_in_postorder showed up in new benchmarks from rust-lang/rustc-perf#2143, hence I gave it a shot to remove an obvious O(n) there.
@osiewicz osiewicz force-pushed the collect-crate-deps-postorder-use-indexset branch from 7aa4bfc to 9b3be25 Compare May 29, 2025 11:02
bors added a commit that referenced this pull request May 29, 2025
…exset, r=

cstore: Use IndexSet as backing store for postorder dependencies

<rustc_metadata::creader::CStore>::push_dependencies_in_postorder showed up in new benchmarks from rust-lang/rustc-perf#2143, hence I gave it a shot to remove an obvious O(n) there.

r? nnethercote
@bors
Copy link
Collaborator

bors commented May 29, 2025

⌛ Testing commit 9b3be25 with merge 0f0df11...

@Kobzol
Copy link
Contributor

Kobzol commented May 29, 2025

Bors got confused as the try build was started just a as a commit was pushed here. I'll cancel the workflow.

@bors
Copy link
Collaborator

bors commented May 29, 2025

💔 Test failed - checks-actions

@Kobzol
Copy link
Contributor

Kobzol commented May 29, 2025

@bors try

@bors
Copy link
Collaborator

bors commented May 29, 2025

⌛ Trying commit 9b3be25 with merge a8791be...

bors added a commit that referenced this pull request May 29, 2025
…exset, r=<try>

cstore: Use IndexSet as backing store for postorder dependencies

<rustc_metadata::creader::CStore>::push_dependencies_in_postorder showed up in new benchmarks from rust-lang/rustc-perf#2143, hence I gave it a shot to remove an obvious O(n) there.

r? nnethercote
@bors
Copy link
Collaborator

bors commented May 29, 2025

☀️ Try build successful - checks-actions
Build commit: a8791be (a8791bea639ea3cb555d4c410091517cd0e406f3)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a8791be): comparison URL.

Overall result: ✅ improvements - no 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.

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

Instruction count

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-5.2%, -0.4%] 12
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -1.9%, secondary -2.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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.6% [0.6%, 0.7%] 3
Improvements ✅
(primary)
-1.9% [-3.4%, -1.1%] 7
Improvements ✅
(secondary)
-2.6% [-5.1%, -0.5%] 56
All ❌✅ (primary) -1.9% [-3.4%, -1.1%] 7

Cycles

Results (secondary -1.0%)

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.6% [0.5%, 0.7%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.3% [-2.4%, -0.4%] 11
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 777.423s -> 777.791s (0.05%)
Artifact size: 368.47 MiB -> 368.48 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 29, 2025
@bjorn3
Copy link
Member

bjorn3 commented May 29, 2025

Significant improvements for large-workspace as expected and almost no effect on all other benchmarks. Interestingly this also improves max-rss a bit across the board.

@rust-log-analyzer

This comment has been minimized.

@osiewicz osiewicz force-pushed the collect-crate-deps-postorder-use-indexset branch from b041d17 to 5e61f5e Compare May 29, 2025 20:43
@nnethercote
Copy link
Contributor

Interestingly this also improves max-rss a bit across the board.

I don't understand that, and I'm very suspicious. An IndexSet can only be larger than an equivalent Vec. Let's see if the results hold up on the post-merge perf run.

Anyway, the icount results look great. Nice work!

@bors r+

@bors
Copy link
Collaborator

bors commented May 29, 2025

📌 Commit 5e61f5e has been approved by nnethercote

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 May 29, 2025
@osiewicz
Copy link
Contributor Author

This PR also changed the call in query system from alloc_slice to alloc_from_iter - could that be the source of a RSS difference?

@nnethercote
Copy link
Contributor

Seems unlikely. I did a local before/after profile with DHAT on helloworld (one of the most-affected benchmarks) and didn't see any difference between the profiles.

@bors
Copy link
Collaborator

bors commented Jun 1, 2025

⌛ Testing commit 5e61f5e with merge ba55b7c...

@bors
Copy link
Collaborator

bors commented Jun 1, 2025

☀️ Test successful - checks-actions
Approved by: nnethercote
Pushing ba55b7c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 1, 2025
@bors bors merged commit ba55b7c into rust-lang:master Jun 1, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 1, 2025
Copy link
Contributor

github-actions bot commented Jun 1, 2025

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 13a4540 (parent) -> ba55b7c (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard ba55b7ce3cd931af7123e334647584f6fbdb3c20 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-aarch64-linux: 7816.5s -> 5466.3s (-30.1%)
  2. x86_64-apple-2: 5688.5s -> 4429.5s (-22.1%)
  3. dist-apple-various: 8386.8s -> 6902.8s (-17.7%)
  4. dist-aarch64-apple: 6027.8s -> 5427.5s (-10.0%)
  5. aarch64-apple: 5203.2s -> 4888.6s (-6.0%)
  6. x86_64-apple-1: 6776.7s -> 7181.9s (6.0%)
  7. dist-x86_64-musl: 7310.6s -> 7718.5s (5.6%)
  8. dist-arm-linux-musl: 6008.2s -> 5732.2s (-4.6%)
  9. dist-x86_64-apple: 9122.9s -> 9525.3s (4.4%)
  10. dist-i686-msvc: 7234.6s -> 6916.8s (-4.4%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ba55b7c): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-5.2%, -0.4%] 11
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -0.1%)

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.9% [0.5%, 1.8%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-3.0%, -0.9%] 3
All ❌✅ (primary) - - 0

Cycles

Results (primary -1.6%, 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.0% [0.5%, 2.2%] 5
Improvements ✅
(primary)
-1.6% [-1.9%, -1.4%] 3
Improvements ✅
(secondary)
-2.0% [-4.4%, -0.4%] 19
All ❌✅ (primary) -1.6% [-1.9%, -1.4%] 3

Binary size

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

Bootstrap: 775.153s -> 774.617s (-0.07%)
Artifact size: 372.28 MiB -> 372.30 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

9 participants