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

Skip rendering metadata strings from include_str!/include_bytes! #115286

Merged
merged 1 commit into from
Sep 2, 2023

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Aug 27, 2023

The const rendering code in rustdoc completely ignores consts from expansions, but the compiler was rendering all consts. So some consts (namely those from include_bytes!) were rendered then ignored.

Most of the diff here is from moving print_const_expr from rustdoc into rustc_hir_pretty so that it can be used in rustdoc and when building rmeta files.

@rustbot

This comment was marked as outdated.

@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 Aug 27, 2023
@saethlin
Copy link
Member Author

r? compiler

@rustbot rustbot assigned petrochenkov and unassigned TaKO8Ki Aug 27, 2023
compiler/rustc_metadata/src/rmeta/encoder.rs Outdated Show resolved Hide resolved
compiler/rustc_ast/src/ast.rs Outdated Show resolved Hide resolved
@petrochenkov petrochenkov 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 Aug 30, 2023
@saethlin saethlin 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 Aug 30, 2023
@petrochenkov petrochenkov 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 Aug 31, 2023
@rustbot rustbot added the A-rustdoc-json Area: Rustdoc JSON backend label Aug 31, 2023
@rustbot
Copy link
Collaborator

rustbot commented Aug 31, 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.

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

cc @camelid

@saethlin saethlin 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 Aug 31, 2023
@petrochenkov
Copy link
Contributor

The current version addresses my previous comments, it's just unfortunate that it introduces a new dependency between rustc crates, especially on rustc_middle.

Let's perhaps move print_const_expr directly to compiler\rustc_metadata\src\rmeta\encoder.rs, reexport it through rustc_metadata root, and rename it to rendered_const for consistency with the query.
@rustbot author

@rustbot rustbot 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 Sep 1, 2023
@saethlin
Copy link
Member Author

saethlin commented Sep 1, 2023

Yeah, that seems better. I wish we had a diagram of the rustc crates dependency graph...
@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 Sep 1, 2023
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Sep 2, 2023

📌 Commit 159ad5f has been approved by petrochenkov

It is now in the queue for this repository.

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

bors commented Sep 2, 2023

⌛ Testing commit 159ad5f with merge 1fb6947...

@bors
Copy link
Contributor

bors commented Sep 2, 2023

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing 1fb6947 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 2, 2023
@bors bors merged commit 1fb6947 into rust-lang:master Sep 2, 2023
11 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 2, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1fb6947): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

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

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.3% [0.3%, 0.3%] 1
Regressions ❌
(secondary)
0.4% [0.3%, 0.7%] 6
Improvements ✅
(primary)
-2.9% [-10.3%, -0.3%] 28
Improvements ✅
(secondary)
-2.6% [-3.7%, -1.7%] 9
All ❌✅ (primary) -2.8% [-10.3%, 0.3%] 29

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)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.9% [-4.2%, -1.8%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.1% [-4.2%, 0.5%] 4

Cycles

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)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
-5.5% [-10.8%, -2.0%] 13
Improvements ✅
(secondary)
-2.7% [-3.0%, -2.5%] 3
All ❌✅ (primary) -5.5% [-10.8%, -2.0%] 13

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)
-2.1% [-10.4%, -0.0%] 58
Improvements ✅
(secondary)
-7.7% [-8.2%, -7.3%] 12
All ❌✅ (primary) -2.1% [-10.4%, -0.0%] 58

Bootstrap: 631.705s -> 627.894s (-0.60%)
Artifact size: 316.63 MiB -> 316.38 MiB (-0.08%)

@rustbot rustbot added the perf-regression Performance regression. label Sep 2, 2023
@saethlin
Copy link
Member Author

saethlin commented Sep 2, 2023

Regressions look like recovery from a spurious improvement in the previous run, and are way less significant than the improvements.
@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 2, 2023
@saethlin saethlin deleted the detangler branch September 2, 2023 22:46
@Kobzol
Copy link
Contributor

Kobzol commented Sep 3, 2023

Very nice results, awesome work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend 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