Skip to content

rustdoc: Speed up TypeAliasPart::get #141421

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
merged 3 commits into from
May 24, 2025
Merged

Conversation

nnethercote
Copy link
Contributor

@nnethercote nnethercote commented May 23, 2025

Big speedups here on a couple of the benchmarks.

r? @GuillaumeGomez

@rustbot rustbot added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels May 23, 2025
@nnethercote
Copy link
Contributor Author

@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 23, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 23, 2025
rustdoc: Speed up `TypeAliasPart::get`

r? `@ghost`
@bors
Copy link
Collaborator

bors commented May 23, 2025

⌛ Trying commit e53bbf9 with merge 36aa0e9...

@bors
Copy link
Collaborator

bors commented May 23, 2025

☀️ Try build successful - checks-actions
Build commit: 36aa0e9 (36aa0e98dcc96e3382dd186aef9b16a4d214bfe0)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (36aa0e9): 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)
-19.5% [-78.7%, -0.3%] 8
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -19.5% [-78.7%, -0.3%] 8

Max RSS (memory usage)

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

mean range count
Regressions ❌
(primary)
11.5% [11.5%, 11.5%] 1
Regressions ❌
(secondary)
7.3% [7.3%, 7.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 11.5% [11.5%, 11.5%] 1

Cycles

Results (primary -47.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
Improvements ✅
(primary)
-47.4% [-77.2%, -6.1%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -47.4% [-77.2%, -6.1%] 3

Binary size

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

Bootstrap: 778.581s -> 777.715s (-0.11%)
Artifact size: 365.44 MiB -> 365.46 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 23, 2025
@nnethercote nnethercote marked this pull request as ready for review May 23, 2025 12:30
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 23, 2025
@nnethercote
Copy link
Contributor Author

Details in the individual commits.

@GuillaumeGomez
Copy link
Member

It's super cool, well done!

@bors r+ rollup=iffy

@bors
Copy link
Collaborator

bors commented May 23, 2025

📌 Commit e53bbf9 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 23, 2025

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

@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 23, 2025
@Kobzol
Copy link
Contributor

Kobzol commented May 23, 2025

Awesome result! I wonder if we could somehow automate finding situations where we do a bunch of stuff and then throw away the result without using it. It almost sounds like a simple version of that could be a Clippy lint (this variable is unused in a dataflow path), but that would probably have too many false positives. Or some runtime instrumentation pass that marks variables unused (or only Dropped) after being created :)

The comparison against `text` seems to be unnecessary.
This is a huge perf win for rustdoc on the `typenum` and `nalgebra`
benchmarks, because the `else` branch doesn't get hit much.
@nnethercote
Copy link
Contributor Author

It almost sounds like a simple version of that could be a Clippy lint (this variable is unused in a dataflow path), but that would probably have too many false positives

Sounds like a great idea. @blyxyas suggested the same thing to me.

@nnethercote
Copy link
Contributor Author

@bors r=GuillaumeGomez rollup=never

@bors
Copy link
Collaborator

bors commented May 23, 2025

📌 Commit dfe8fe8 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 24, 2025

⌛ Testing commit dfe8fe8 with merge 105354d...

@bors
Copy link
Collaborator

bors commented May 24, 2025

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing 105354d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 24, 2025
@bors bors merged commit 105354d into rust-lang:master May 24, 2025
7 checks passed
@rustbot rustbot added this to the 1.89.0 milestone May 24, 2025
Copy link

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 80c3498 (parent) -> 105354d (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 105354db48223b7bf799b05d4dd3a412aca7bd05 --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. x86_64-apple-1: 5743.2s -> 7847.0s (36.6%)
  2. dist-apple-various: 6695.7s -> 8706.1s (30.0%)
  3. aarch64-apple: 3926.6s -> 3171.5s (-19.2%)
  4. dist-armv7-linux: 5403.1s -> 6092.2s (12.8%)
  5. dist-x86_64-apple: 7707.3s -> 8288.8s (7.5%)
  6. dist-aarch64-linux: 5328.0s -> 5689.8s (6.8%)
  7. x86_64-rust-for-linux: 2741.4s -> 2557.4s (-6.7%)
  8. x86_64-msvc-ext1: 7372.7s -> 6960.1s (-5.6%)
  9. dist-s390x-linux: 5432.4s -> 5154.9s (-5.1%)
  10. x86_64-gnu-aux: 4467.3s -> 4282.1s (-4.1%)
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 (105354d): 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

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.2% [0.2%, 0.2%] 1
Improvements ✅
(primary)
-19.5% [-78.7%, -0.3%] 8
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) -19.5% [-78.7%, -0.3%] 8

Max RSS (memory usage)

Results (secondary 2.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.

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

Cycles

Results (primary -47.5%)

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)
-47.5% [-77.2%, -6.1%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -47.5% [-77.2%, -6.1%] 3

Binary size

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

Bootstrap: 778.415s -> 777.008s (-0.18%)
Artifact size: 366.33 MiB -> 366.29 MiB (-0.01%)

@rustbot rustbot added the perf-regression Performance regression. label May 24, 2025
@lqd
Copy link
Member

lqd commented May 24, 2025

Pure rustdoc change, so coercions noise.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label May 24, 2025
@nnethercote nnethercote deleted the TypeAliasPart-get branch May 25, 2025 22:11
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. 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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants