Skip to content

Conversation

@nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Oct 9, 2025

Some cleanups and minor perf improvements relating to TaskDeps.

r? @saethlin

There are only two places that create a `TaskDeps`. One constructs it
manually, the other uses `default`. It's weird that `default()` uses a
capacity of 128.

This commit just gets rid of `default` and introduces `new` so that
both construction sites can be equivalent.
`INLINE_CAPACITY` has two different uses:
- It dictates the inline capacity of `EdgesVec::edges`, which is a
  `SmallVec`.
- It dictates when `TaskDeps` switches from a linear scan lookup to a
  hashset lookup to determine if an edge has been seen before.

These two uses are in the same part of the code, but they're
fundamentally separate and don't need to use the same constant.

This commit separates the two uses, and adds some helpful comments,
making the code clearer. It also changes the value used for the
linear/hashset threshold from 8 to 16, which gives slightly better perf.
@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 9, 2025
@nnethercote nnethercote closed this Oct 9, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 9, 2025
@nnethercote nnethercote reopened this Oct 9, 2025
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 9, 2025
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 9, 2025
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 9, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 9, 2025

💥 Test timed out after 21600s

@nnethercote
Copy link
Contributor Author

@bors retry

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 9, 2025
@nnethercote nnethercote closed this Oct 9, 2025
@nnethercote nnethercote reopened this Oct 9, 2025
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 9, 2025
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 9, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 10, 2025

☀️ Try build successful (CI)
Build commit: e4658cf (e4658cffaf309c44def5c182c71fc3b1e4f810d8, parent: b925a865e2c9a0aefe5a2877863cb4df796f2eaf)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e4658cf): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.7% [0.6%, 0.8%] 3
Regressions ❌
(secondary)
0.8% [0.2%, 1.0%] 22
Improvements ✅
(primary)
-0.4% [-1.2%, -0.1%] 29
Improvements ✅
(secondary)
-0.5% [-1.1%, -0.1%] 23
All ❌✅ (primary) -0.3% [-1.2%, 0.8%] 32

Max RSS (memory usage)

Results (primary -0.8%, secondary 0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.9% [0.8%, 2.5%] 3
Regressions ❌
(secondary)
1.8% [1.2%, 2.3%] 2
Improvements ✅
(primary)
-4.8% [-8.8%, -0.9%] 2
Improvements ✅
(secondary)
-1.1% [-1.1%, -1.0%] 2
All ❌✅ (primary) -0.8% [-8.8%, 2.5%] 5

Cycles

Results (secondary -1.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.2% [2.0%, 4.3%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.3% [-4.0%, -2.2%] 7
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 472.277s -> 472.516s (0.05%)
Artifact size: 388.06 MiB -> 388.09 MiB (0.01%)

@bors
Copy link
Collaborator

bors commented Oct 15, 2025

⌛ Testing commit 5d00076 with merge 89342a8...

bors added a commit that referenced this pull request Oct 15, 2025
`TaskDeps` improvements

Some cleanups and minor perf improvements relating to `TaskDeps`.

r? `@saethlin`
@bors
Copy link
Collaborator

bors commented Oct 15, 2025

💔 Test failed - checks-actions

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

Uh, what?

@bors retry

@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 Oct 15, 2025
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[endgroup]
Image input checksum da75e33fbcc6bcc3f436fedc7bbe55684a3f7a37b83ffcbfc5c587652c6f86a6ee2d93cf356e1bd2824f4f3cdacdaf47e2a47b47f7619a9190ab588ebcc118e3
##[group]Building docker image for x86_64-rust-for-linux
Docker version 28.0.4, build b8034c0
Error response from daemon: Get "https://ghcr.io/v2/": Get "https://ghcr.io/token?account=rust-lang&client_id=docker&offline_token=true&service=ghcr.io": net/http: request canceled (Client.Timeout exceeded while awaiting headers) (Client.Timeout exceeded while awaiting headers)
****************************************************************************
To find more information about this job, visit the following URL:
https://rustc-dev-guide.rust-lang.org/tests/rust-for-linux.html
****************************************************************************
##[error]Process completed with exit code 1.

@nnethercote
Copy link
Contributor Author

@bors retry

bors added a commit that referenced this pull request Oct 16, 2025
`TaskDeps` improvements

Some cleanups and minor perf improvements relating to `TaskDeps`.

r? `@saethlin`
@bors
Copy link
Collaborator

bors commented Oct 16, 2025

⌛ Testing commit 5d00076 with merge 3b3b2ea...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-mingw-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

error: test failed, to rerun pass `-p std --test sync`
Bootstrap failed while executing `test --stage 2 --skip=compiler --skip=src`
Build completed unsuccessfully in 2:14:36
make: *** [Makefile:123: ci-mingw-x] Error 1
  local time: Thu Oct 16 14:03:24 CUT 2025
  network time: Thu, 16 Oct 2025 14:03:25 GMT
##[error]Process completed with exit code 2.
##[group]Run echo "disk usage:"
echo "disk usage:"

@bors
Copy link
Collaborator

bors commented Oct 16, 2025

💔 Test failed - checks-actions

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

The real failure was this, which doesn't seem related to the changes in this PR, sigh:

2025-10-16T14:03:24.5908828Z failures:
2025-10-16T14:03:24.5909052Z 
2025-10-16T14:03:24.5909735Z ---- condvar::nonpoison_timeout_nanoseconds stdout ----
2025-10-16T14:03:24.5910121Z 
2025-10-16T14:03:24.5910856Z thread 'condvar::nonpoison_timeout_nanoseconds' (3328) panicked at library\std\tests\sync\condvar.rs:298:13:
2025-10-16T14:03:24.5912086Z assertion failed: *guard
2025-10-16T14:03:24.5912443Z stack backtrace:
2025-10-16T14:03:24.5912756Z    0: __rustc::rust_begin_unwind
2025-10-16T14:03:24.5913140Z    1: core::panicking::panic_fmt
2025-10-16T14:03:24.5913533Z    2: core::panicking::panic
2025-10-16T14:03:24.5913941Z    3: core::ops::function::FnOnce::call_once
2025-10-16T14:03:24.5914587Z note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
2025-10-16T14:03:24.5915323Z ---- condvar::nonpoison_timeout_nanoseconds stdout end ----
2025-10-16T14:03:24.5915726Z 
2025-10-16T14:03:24.5915831Z failures:
2025-10-16T14:03:24.5916130Z     condvar::nonpoison_timeout_nanoseconds
2025-10-16T14:03:24.5916431Z 
2025-10-16T14:03:24.5916831Z test result: FAILED. 316 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.36s

@saethlin
Copy link
Member

Agreed. I'm really starting to wonder if this PR is cursed.

@nnethercote
Copy link
Contributor Author

@bors retry

@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 Oct 17, 2025
@bors
Copy link
Collaborator

bors commented Oct 17, 2025

⌛ Testing commit 5d00076 with merge 28c4c7d...

@bors
Copy link
Collaborator

bors commented Oct 17, 2025

☀️ Test successful - checks-actions
Approved by: saethlin
Pushing 28c4c7d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 17, 2025
@bors bors merged commit 28c4c7d into rust-lang:master Oct 17, 2025
22 of 25 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 17, 2025
@github-actions
Copy link
Contributor

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 53a741f (parent) -> 28c4c7d (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 28c4c7d7abced7b35c49f38149b9cb6ea27dd2a6 --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-x86_64-apple: 10030.7s -> 6584.0s (-34.4%)
  2. dist-aarch64-apple: 9278.1s -> 6414.9s (-30.9%)
  3. dist-apple-various: 4705.3s -> 3663.8s (-22.1%)
  4. dist-aarch64-msvc: 5644.3s -> 6829.8s (21.0%)
  5. aarch64-apple: 9168.3s -> 7696.0s (-16.1%)
  6. x86_64-gnu-llvm-20-1: 3681.7s -> 3188.3s (-13.4%)
  7. x86_64-gnu-tools: 3318.6s -> 3661.0s (10.3%)
  8. test-various: 4908.3s -> 4408.2s (-10.2%)
  9. dist-powerpc-linux: 5504.2s -> 4961.2s (-9.9%)
  10. x86_64-msvc-ext3: 7021.4s -> 6361.3s (-9.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 (28c4c7d): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
0.5% [0.2%, 0.8%] 17
Improvements ✅
(primary)
-0.4% [-1.0%, -0.1%] 25
Improvements ✅
(secondary)
-0.7% [-1.2%, -0.2%] 22
All ❌✅ (primary) -0.4% [-1.0%, 0.5%] 26

Max RSS (memory usage)

Results (primary 0.8%, secondary -1.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.8% [0.8%, 0.8%] 1
Regressions ❌
(secondary)
1.8% [1.8%, 1.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-4.1%, -2.1%] 2
All ❌✅ (primary) 0.8% [0.8%, 0.8%] 1

Cycles

Results (primary -3.9%, secondary 1.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
6.1% [6.1%, 6.1%] 1
Improvements ✅
(primary)
-3.9% [-3.9%, -3.9%] 1
Improvements ✅
(secondary)
-3.4% [-3.4%, -3.4%] 1
All ❌✅ (primary) -3.9% [-3.9%, -3.9%] 1

Binary size

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

Bootstrap: 475.105s -> 474.3s (-0.17%)
Artifact size: 390.35 MiB -> 390.30 MiB (-0.01%)

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. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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.

7 participants