-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
update hash_stable
for List<Ty<'tcx>>
#94799
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 299dd02 with merge f93e80bc1db68d23901d970c4aec9e66a47c4b27... |
☀️ Try build successful - checks-actions |
Queued f93e80bc1db68d23901d970c4aec9e66a47c4b27 with parent 01ad0ad, future comparison URL. |
Finished benchmarking commit (f93e80bc1db68d23901d970c4aec9e66a47c4b27): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. 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 led to changes in compiler perf. @bors rollup=never |
will probably have to try something different @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 5b6b348 with merge b9782aa0f530788d0f64887480f97c9f895815d2... |
☀️ Try build successful - checks-actions |
Queued b9782aa0f530788d0f64887480f97c9f895815d2 with parent d7b282b, future comparison URL. |
Finished benchmarking commit (b9782aa0f530788d0f64887480f97c9f895815d2): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. 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 led to changes in compiler perf. @bors rollup=never |
alright, wasn't the reason for the perf impact, but I still believe that this is a small improvement. If this is merged nobody else will try the same change in the future and it doesn't make anything worse 🤷 @bors ready |
I don't understand what was the point of #93505. |
I also don't understand how the enum E {
A(u8),
B(u8),
} hashing the discriminant (or some other distinct number) is necessary because the payloads have the same type and may collide. But with enum E {
A(OneType),
B(EntirelyDifferentType),
} it's not clear why the discriminant should be hashed, and why hashing |
I mostly added this to enable
if you have enum OneType {
VariantA(u32),
VariantB(u8),
}
enum EntirelyDifferentType {
VariantA,
VariantB(u8),
} hashing I don't think it is trivially apparent that |
keeping the reasoning from #94799 (comment)
@petrochenkov depending on your opinion here, feel free to either approve or close this PR |
@bors r+ |
📌 Commit 5b6b348 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (c51871c): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
…errors Don't transmute `&List<GenericArg>` <-> `&List<Ty>` In rust-lang#93505 we allowed safely transmuting between `&List<GenericArg<'_>>` and `&List<Ty<'_>>`. This was possible because `GenericArg` is a tagged pointer and the tag for types is `0b00`, such that a `GenericArg` with a type inside has the same layout as `Ty`. While this was meant as an optimization, it doesn't look like it was actually any perf or max-rss win (see rust-lang#94799 (comment), rust-lang#94841, rust-lang#110496 (comment)). Additionally the way it was done is quite fragile — `unsafe` code was not properly documented or contained in a module, types were not marked as `repr(C)` (making the transmutes possibly unsound). All of this makes the code maintenance harder and blocks other possible optimizations (as an example I've found out about these `transmutes` when my change caused them to sigsegv compiler). Thus, I think we can safely (pun intended) remove those transmutes, making maintenance easier, optimizations possible, code less cursed, etc. r? `@compiler-errors`
Don't transmute `&List<GenericArg>` <-> `&List<Ty>` In #93505 we allowed safely transmuting between `&List<GenericArg<'_>>` and `&List<Ty<'_>>`. This was possible because `GenericArg` is a tagged pointer and the tag for types is `0b00`, such that a `GenericArg` with a type inside has the same layout as `Ty`. While this was meant as an optimization, it doesn't look like it was actually any perf or max-rss win (see rust-lang/rust#94799 (comment), rust-lang/rust#94841, rust-lang/rust#110496 (comment)). Additionally the way it was done is quite fragile — `unsafe` code was not properly documented or contained in a module, types were not marked as `repr(C)` (making the transmutes possibly unsound). All of this makes the code maintenance harder and blocks other possible optimizations (as an example I've found out about these `transmutes` when my change caused them to sigsegv compiler). Thus, I think we can safely (pun intended) remove those transmutes, making maintenance easier, optimizations possible, code less cursed, etc. r? `@compiler-errors`
cc #93505 (comment)
this is the hottest part changed since the pre-merge perf run