Uh oh!
There was an error while loading. Please reload this page.
Optimize impl Hash for ObligationCauseData by not hashing ObligationCauseCode variant fields - #90996
Conversation
selection deduplicates obligations through a hashset at some point, computing the hashes for ObligationCauseCode appears to dominate the hashing cost. bodyid + span + discriminant hash hopefully will sufficiently unique unique enough.
matthewjasper
commented
Nov 18, 2021
@bors try @rust-timer queue |
rust-timer
commented
Nov 18, 2021
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
bors
commented
Nov 18, 2021
⌛ Trying commit 78b5f2d with merge 4d6fdfcc90813f646820764dbf3cc985d883d9af... |
bors
commented
Nov 18, 2021
☀️ Try build successful - checks-actions |
rust-timer
commented
Nov 18, 2021
Queued 4d6fdfcc90813f646820764dbf3cc985d883d9af with parent 6414e0b, future comparison URL. |
the8472
commented
Nov 18, 2021
Huh, this shouldn't need another perf run, I already linked one for this commit in my opening comment.
|
rust-timer
commented
Nov 18, 2021
Finished benchmarking commit (4d6fdfcc90813f646820764dbf3cc985d883d9af): comparison url. Summary: This change led to very large relevant mixed results 🤷 in compiler performance.
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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
The wg-grammar change probably is noise since it didn't show up in the previous perf run on the same commit changes. incr-unchanged runs are quite sensitive to the 1/32-randomized incremental cache verification. |
matthewjasper
commented
Nov 18, 2021
@bors r+ |
bors
commented
Nov 18, 2021
📌 Commit 78b5f2d has been approved by |
camelid
commented
Nov 18, 2021
Should this be marked as relnotes-perf? Documenting diesel was sped up by 58%! (cc @rust-lang/rustdoc) |
GuillaumeGomez
commented
Nov 19, 2021
Sounds like it is definitely worth mentioning it indeed! |
bors
commented
Nov 19, 2021
bors
commented
Nov 19, 2021
☀️ Test successful - checks-actions |
rust-timer
commented
Nov 19, 2021
Finished benchmarking commit (18fa434): comparison url. Summary: This change led to very large relevant improvements 🎉 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
| pub code: ObligationCauseCode<'tcx>, | ||
| } | ||
| impl Hash for ObligationCauseData<'_> { |
There was a problem hiding this comment.
For next time: I suggest leaving a brief comment explaining why this custom hash is used, because it's non-obvious and no fun to have to dig through version control history to understand why.
There was a problem hiding this comment.
Please open an issue so it's not forgotten.
There was a problem hiding this comment.
I'm not opposed to adding comments but
no fun to have to dig through version control history
seems a bit subjective, for me that's 3 clicks which is hardly onerous. So that didn't quite meet my threshold of adding a comment.
Split out from #90913 since it's a clear performance win and should be easier to review.
It speeds up hashing for
Obligationdeduplication by only hashing the discriminant of theObligationCauseCodeenum instead of its contents. That shouldn't affect hash quality much since there are several other fields inObligationwhich should be unique enough, especially the predicate itself which is hashed as an interned pointer.