-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Use FxHashSet instead of Vec for well formed tys #88771
Conversation
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit ba67d85ae338bbb4ab1b840e9bf57883cad1efdd with merge 05ee7be89fecd02defa835ceae7c6c57e8582a12... |
☀️ Try build successful - checks-actions |
Queued 05ee7be89fecd02defa835ceae7c6c57e8582a12 with parent 626649f, future comparison URL. |
Finished benchmarking commit (05ee7be89fecd02defa835ceae7c6c57e8582a12): comparison url. Summary: This change led to large relevant improvements 🎉 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. @bors rollup=never |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 8e7613f with merge 4508123e015a7afc057ce1b1b417413dc7c45059... |
☀️ Try build successful - checks-actions |
Queued 4508123e015a7afc057ce1b1b417413dc7c45059 with parent 497ee32, future comparison URL. |
Finished benchmarking commit (4508123e015a7afc057ce1b1b417413dc7c45059): comparison url. Summary: This change led to large relevant improvements 🎉 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. @bors rollup=never |
Doesn't win back all the perf lost from #88312, but is better. I'm not sure that there's a way to win more perf without changing the approach completely. So, I think this is probably worth merging and accepting the difference. cc @rylev regarding perf r? rust-lang/compiler |
@bors r+ |
📌 Commit 8e7613f has been approved by |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
☀️ Test successful - checks-actions |
Finished benchmarking commit (9ef27bf): comparison url. Summary: This change led to 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 |
fn_sig_tys: &[Ty<'tcx>], | ||
fn_sig_tys: FxHashSet<Ty<'tcx>>, | ||
body_id: hir::HirId, | ||
span: Span, | ||
) { | ||
debug!("add_implied_bounds()"); | ||
|
||
for &ty in fn_sig_tys { | ||
for ty in fn_sig_tys { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is iterating on a FxHashSet<Ty<'tcx>>
, which will depend on ASLR (random memory allocation order) and the results could be observable (e.g. potentially in diagnostics order).
I wonder if we should ban iterating FxHash{Set,Map}
and force the use of FxIndex{Set,Map}
instead (since presumably the insertion order is deterministic).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also #63713 (comment) - we should probably use internal lints to force this harder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should ban iterating
FxHash{Set,Map}
YES! I think recommending FxIndex{Set,Map}
is probably the right choice, using an internal lint when using a FxIndexSet
in a potentially nondet way. Now if the order doesn't matter, e.g. checking for existence without any sideeffects, this lint could be explicitly allowed.
Not sure what's the best way to write such a lint though 😅
Trying to recover perf from #88312
r? @ghost