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

rustdoc perf: clone clean::Item less #130857

Merged
merged 3 commits into from
Sep 27, 2024
Merged

Conversation

lukas-code
Copy link
Member

@lukas-code lukas-code commented Sep 25, 2024

In #130798, I caused a small perf regression for rustdoc (see #130807 (comment)), so here is a small improvement to make up for it 😺.

This change is actually unrelated to the minor perf regression in Item::stability and instead fixes a more relevant perf problem that I found while investigating: For certain crates with many impls on type aliases, we unnecessarily cloned large clean::Items multiple times -- now we just borrow them.

Lukas Markeffsky added 3 commits September 25, 2024 23:45
Don't keep the `external_traits` as shared mutable data between the
`DocContext` and `clean::Crate`. Instead, move the data over when necessary.
This allows us to get rid of a borrowck hack in the `DocVisitor`.
This allows the visitor to borrow from the visitees.
@lukas-code lukas-code added the S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. label Sep 25, 2024
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Sep 25, 2024
@lukas-code lukas-code removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 25, 2024
@lukas-code
Copy link
Member 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 Sep 25, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 25, 2024
rustdoc perf: clone `clean::Item` less

In rust-lang#130798, I caused a small perf regression for rustdoc (see rust-lang#130807 (comment)), so here is a small improvement to make up for it 😺.

r? ghost
@bors
Copy link
Contributor

bors commented Sep 25, 2024

⌛ Trying commit 345077a with merge 30e0b90...

@bors
Copy link
Contributor

bors commented Sep 26, 2024

☀️ Try build successful - checks-actions
Build commit: 30e0b90 (30e0b903dddde0b3027145ac674a4d183cc0898f)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (30e0b90): 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 a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-6.3% [-15.5%, -0.2%] 3
Improvements ✅
(secondary)
-1.4% [-1.4%, -1.4%] 1
All ❌✅ (primary) -6.3% [-15.5%, -0.2%] 3

Max RSS (memory usage)

Results (primary -28.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)
2.5% [2.5%, 2.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-38.6% [-78.0%, -2.6%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -28.3% [-78.0%, 2.5%] 4

Cycles

Results (primary -15.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)
2.4% [2.2%, 2.7%] 3
Improvements ✅
(primary)
-15.9% [-15.9%, -15.9%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -15.9% [-15.9%, -15.9%] 1

Binary size

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

Bootstrap: 772.322s -> 772.862s (0.07%)
Artifact size: 340.90 MiB -> 340.91 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 26, 2024
@lukas-code lukas-code marked this pull request as ready for review September 26, 2024 14:24
@rustbot
Copy link
Collaborator

rustbot commented Sep 26, 2024

Some changes occurred in src/librustdoc/clean/types.rs

cc @camelid

@lukas-code
Copy link
Member Author

r? @notriddle

@lukas-code lukas-code added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. labels Sep 26, 2024
@notriddle
Copy link
Contributor

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Sep 26, 2024

📌 Commit 345077a has been approved by notriddle

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 Sep 26, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 27, 2024
…iddle

rustdoc perf: clone `clean::Item` less

In rust-lang#130798, I caused a small perf regression for rustdoc (see rust-lang#130807 (comment)), so here is a small improvement to make up for it 😺.

This change is actually unrelated to the minor perf regression in `Item::stability` and instead fixes a more relevant perf problem that I found while investigating: For certain crates with many impls on type aliases, we unnecessarily cloned large `clean::Item`s multiple times -- now we just borrow them.
@bors
Copy link
Contributor

bors commented Sep 27, 2024

⌛ Testing commit 345077a with merge 73a5576...

@bors
Copy link
Contributor

bors commented Sep 27, 2024

💔 Test failed - checks-actions

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 27, 2024
@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 27, 2024
@rust-log-analyzer
Copy link
Collaborator

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

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

@notriddle
Copy link
Contributor

500 error from Docket registry

@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 Sep 27, 2024
@bors
Copy link
Contributor

bors commented Sep 27, 2024

⌛ Testing commit 345077a with merge a3f76a2...

@bors
Copy link
Contributor

bors commented Sep 27, 2024

☀️ Test successful - checks-actions
Approved by: notriddle
Pushing a3f76a2 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 27, 2024
@bors bors merged commit a3f76a2 into rust-lang:master Sep 27, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 27, 2024
@lukas-code lukas-code deleted the no-clones-allowed branch September 27, 2024 12:59
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a3f76a2): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-9.3% [-15.5%, -3.1%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -9.3% [-15.5%, -3.1%] 2

Max RSS (memory usage)

Results (primary -28.3%, 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)
1.7% [1.7%, 1.7%] 1
Regressions ❌
(secondary)
2.5% [2.3%, 2.8%] 2
Improvements ✅
(primary)
-38.3% [-78.5%, -1.2%] 3
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) -28.3% [-78.5%, 1.7%] 4

Cycles

Results (primary -16.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
Improvements ✅
(primary)
-16.1% [-16.1%, -16.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -16.1% [-16.1%, -16.1%] 1

Binary size

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

Bootstrap: 775.094s -> 776.908s (0.23%)
Artifact size: 341.33 MiB -> 341.40 MiB (0.02%)

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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants