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

Avoid specialization in the metadata serialization code #119478

Merged
merged 6 commits into from
Jan 6, 2024

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Dec 31, 2023

With the exception of a perf-only specialization for byte slices and byte vectors.

This uses the same trick of introducing a new trait and having the Encodable and Decodable derives add a bound to it as used for TyEncoder/TyDecoder. The new code is clearer about which encoder/decoder uses which impl and it reduces the dependency of rustc on specialization, making it easier to remove support for specialization entirely or turn it into a construct that is only allowed for perf optimizations if we decide to do this.

@rustbot
Copy link
Collaborator

rustbot commented Dec 31, 2023

r? @wesleywiser

(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 Dec 31, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 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.

@bjorn3
Copy link
Member Author

bjorn3 commented Dec 31, 2023

@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 Dec 31, 2023
@bors
Copy link
Contributor

bors commented Dec 31, 2023

⌛ Trying commit 47936b4 with merge 2230d93...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 31, 2023
…r=<try>

Avoid specialization in the metadata serialization code

With the exception of a perf-only specialization for byte slices and byte vectors.

This uses the same trick of introducing a new trait and having the Encodable and Decodable derives add a bound to it as used for TyEncoder/TyDecoder. The new code is clearer about which encoder/decoder uses which impl and it reduces the dependency of rustc on specialization, making it easier to remove support for specialization entirely or turn it into a construct that is only allowed for perf optimizations if we decide to do this.
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bjorn3
Copy link
Member Author

bjorn3 commented Dec 31, 2023

@rust-timer check 2230d93

@bjorn3
Copy link
Member Author

bjorn3 commented Dec 31, 2023

@rust-timer build 2230d93

@rust-timer

This comment has been minimized.

@Noratrieb
Copy link
Member

very cool. I'm wondering whether it makes sense to have the extra Span{En,De}coder traits or whether it may make more sense to just merge rustc_serialize and rustc_span and unify it into a single {En,De}coder trait...

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2230d93): comparison URL.

Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric.

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)
2.8% [2.8%, 2.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.1% [-4.1%, -4.1%] 1
All ❌✅ (primary) 2.8% [2.8%, 2.8%] 1

Cycles

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

Binary size

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

Bootstrap: 666.95s -> 666.518s (-0.06%)
Artifact size: 311.74 MiB -> 311.74 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 1, 2024
@bjorn3
Copy link
Member Author

bjorn3 commented Jan 1, 2024

@Nilstrieb I've considered that, but assumed it would be more controversial.

@Noratrieb
Copy link
Member

Let's keep it like this for now, we can always change it later.

compiler/rustc_span/src/lib.rs Show resolved Hide resolved
@wesleywiser
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 2, 2024

📌 Commit 8fb8e6e has been approved by wesleywiser

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jan 2, 2024

🌲 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 Jan 2, 2024
@bors
Copy link
Contributor

bors commented Jan 6, 2024

⌛ Testing commit 8fb8e6e with merge e21f4cd...

@bors
Copy link
Contributor

bors commented Jan 6, 2024

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing e21f4cd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 6, 2024
@bors bors merged commit e21f4cd into rust-lang:master Jan 6, 2024
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 6, 2024
@bjorn3 bjorn3 deleted the no_serialize_specialization branch January 6, 2024 11:59
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e21f4cd): comparison URL.

Overall result: ❌ regressions - 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)
3.8% [3.8%, 3.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.8% [3.8%, 3.8%] 1

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.8% [3.7%, 3.9%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.5% [-10.0%, -3.1%] 2
All ❌✅ (primary) - - 0

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)
3.5% [3.5%, 3.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.5% [3.5%, 3.5%] 1

Binary size

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

Bootstrap: 665.332s -> 666.487s (0.17%)
Artifact size: 308.58 MiB -> 308.53 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-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