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

rustc_metadata: Filter encoded data more aggressively using DefKind #109765

Merged
merged 2 commits into from
Apr 11, 2023

Conversation

petrochenkov
Copy link
Contributor

I focused on data that contains spans, because spans are expensive to encode/decode/hash, but also touched should_encode_visibility too.

One incorrect use of impl visibility in diagnostics is also replaced with trait visibility.

@rustbot
Copy link
Collaborator

rustbot commented Mar 30, 2023

r? @jackh726

(rustbot has picked a reviewer for you, use r? to override)

@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 Mar 30, 2023
@petrochenkov
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 Mar 30, 2023
@bors
Copy link
Contributor

bors commented Mar 30, 2023

⌛ Trying commit 462c49f2301dd11b5634a8f07beb58732bbf3f9b with merge bef788b9e938a86104d5e6fd1c413440c5d305a2...

@bors

This comment was marked as resolved.

@bors bors 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 Mar 30, 2023
@rustbot
Copy link
Collaborator

rustbot commented Mar 30, 2023

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

cc @camelid

@petrochenkov
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Mar 30, 2023

⌛ Trying commit 450109fe5dbfb024ad330bcfdd3f8741d0b51700 with merge c106784be1adfcb22d4ef5333f61698de37db28e...

@bors
Copy link
Contributor

bors commented Mar 30, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c106784be1adfcb22d4ef5333f61698de37db28e): 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)
-0.9% [-1.7%, -0.2%] 100
Improvements ✅
(secondary)
-1.1% [-3.4%, -0.1%] 37
All ❌✅ (primary) -0.9% [-1.7%, -0.2%] 100

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
Regressions ❌
(secondary)
3.0% [2.8%, 3.2%] 3
Improvements ✅
(primary)
-1.3% [-2.0%, -0.5%] 7
Improvements ✅
(secondary)
-1.7% [-2.2%, -0.9%] 4
All ❌✅ (primary) -1.3% [-2.0%, -0.5%] 7

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)
- - 0
Improvements ✅
(primary)
-1.9% [-2.9%, -0.8%] 35
Improvements ✅
(secondary)
-3.1% [-5.0%, -1.3%] 14
All ❌✅ (primary) -1.9% [-2.9%, -0.8%] 35

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 30, 2023
@petrochenkov
Copy link
Contributor Author

@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 Mar 30, 2023
@petrochenkov
Copy link
Contributor Author

Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those large matches are not the easiest thing to review...
How did you determine them?
Is there any way to be certain, or should we just wait for bug reports?

@@ -21,10 +21,17 @@ error[E0223]: ambiguous associated type
LL | type X = std::ops::Deref::Target;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
help: if there were a type named `Example` that implemented `Deref`, you could use the fully-qualified path
help: use the fully-qualified path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the output change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the compiler/rustc_hir_analysis/src/astconv/mod.rs change.
Previously, impl visibility was used, but impl visibility is meaningless (and no longer encoded with this PR), trait visibility was actually intended there.

@@ -825,25 +825,136 @@ fn should_encode_visibility(def_kind: DefKind) -> bool {
| DefKind::ForeignTy
| DefKind::TraitAlias
| DefKind::AssocTy
| DefKind::TyParam
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only TyParam and not LifetimeParam and ConstParam?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some spans are only encoded for diagnostics.
Errors related to type parameters may report different diagnostics than errors related to other generic parameters.

It could make sense to drop extern spans for type parameter diagnostics too, to optimize the "good path".

@petrochenkov
Copy link
Contributor Author

@cjgillot

How did you determine them?

Some common sense initially (named items that get into non-reexport module_items typically need to have everything encoded, others not so much), then ICEs from the test suite to fix non-obvious cases.

Is there any way to be certain, or should we just wait for bug reports?

Wait for bug reports, I guess.
If some rare case that is not currently covered by the test suite uses some missing piece of data, we can add it to the test suite and either encode that data or stop using it.

@jackh726
Copy link
Member

jackh726 commented Apr 9, 2023

r? @cjgillot

@bors

This comment was marked as resolved.

@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 Apr 10, 2023
@petrochenkov
Copy link
Contributor Author

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Apr 10, 2023

📌 Commit f5a9f6f has been approved by cjgillot

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 Apr 10, 2023
@bors
Copy link
Contributor

bors commented Apr 10, 2023

⌛ Testing commit f5a9f6f with merge 8b0362a3b018c68c3bd176a162565249a30eb272...

@bors
Copy link
Contributor

bors commented Apr 10, 2023

💔 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 Apr 10, 2023
@rust-log-analyzer

This comment has been minimized.

@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)

@petrochenkov
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 Apr 11, 2023
@bors
Copy link
Contributor

bors commented Apr 11, 2023

⌛ Testing commit f5a9f6f with merge dfe024e...

@bors
Copy link
Contributor

bors commented Apr 11, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing dfe024e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 11, 2023
@bors bors merged commit dfe024e into rust-lang:master Apr 11, 2023
@rustbot rustbot added this to the 1.70.0 milestone Apr 11, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (dfe024e): 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.7% [0.7%, 0.7%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.0% [-1.8%, -0.2%] 101
Improvements ✅
(secondary)
-1.2% [-3.6%, -0.1%] 34
All ❌✅ (primary) -0.9% [-1.8%, 0.7%] 102

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
Regressions ❌
(secondary)
3.3% [3.3%, 3.3%] 1
Improvements ✅
(primary)
-1.5% [-4.4%, -0.4%] 16
Improvements ✅
(secondary)
-1.0% [-1.5%, -0.6%] 3
All ❌✅ (primary) -1.5% [-4.4%, -0.4%] 16

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.4% [2.1%, 2.6%] 4
Improvements ✅
(primary)
-1.7% [-2.7%, -0.6%] 38
Improvements ✅
(secondary)
-3.0% [-4.2%, -2.3%] 12
All ❌✅ (primary) -1.7% [-2.7%, -0.6%] 38

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.

7 participants