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

Remove unnecessary sorts in rustc_hir_analysis #131328

Conversation

ismailarilik
Copy link
Contributor

A follow-up after #131140. Here the related objects are IndexSet so do not require a sort to stay stable. And they don't need to be mut anymore.

r? @compiler-errors

This is an attempt to gain the performance loss after the PR rust-lang#131140.
Here the related objects are `IndexSet` so do not require a sort to stay stable.
@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 Oct 6, 2024
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

ill approve when ci is green

@ismailarilik
Copy link
Contributor Author

You are very fast: #131140 (comment)
Thank you! =)

let mut impl_blocks =
region.impl_blocks.into_iter().collect::<SmallVec<[usize; 8]>>();
impl_blocks.sort_unstable();
let impl_blocks = region.impl_blocks.into_iter().collect::<SmallVec<[usize; 8]>>();
Copy link
Contributor

@klensy klensy Oct 6, 2024

Choose a reason for hiding this comment

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

That into_iter().collect() can actually be skipped?
No, there is nested for :-(

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be possible to use the IndexSet::as_slice API

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 14, 2024

📌 Commit a0e687f has been approved by compiler-errors

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 Oct 14, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 14, 2024
…rts-in-rustc-hir-analysis, r=compiler-errors

Remove unnecessary sorts in `rustc_hir_analysis`

A follow-up after rust-lang#131140. Here the related objects are `IndexSet` so do not require a sort to stay stable. And they don't need to be `mut` anymore.

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 14, 2024
…rts-in-rustc-hir-analysis, r=compiler-errors

Remove unnecessary sorts in `rustc_hir_analysis`

A follow-up after rust-lang#131140. Here the related objects are `IndexSet` so do not require a sort to stay stable. And they don't need to be `mut` anymore.

r? ``@compiler-errors``
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 15, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#122670 (Fix bug where `option_env!` would return `None` when env var is present but not valid Unicode)
 - rust-lang#130568 (Make some float methods unstable `const fn`)
 - rust-lang#131137 (Add 1.82 release notes)
 - rust-lang#131328 (Remove unnecessary sorts in `rustc_hir_analysis`)
 - rust-lang#131652 (Move polarity into `PolyTraitRef` rather than storing it on the side)
 - rust-lang#131675 (Update lint message for ABI not supported)
 - rust-lang#131681 (Fix up-to-date checking for run-make tests)
 - rust-lang#131703 (Resolved python deprecation warning in publish_toolstate.py)
 - rust-lang#131706 (Fix two const-hacks)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 15, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#130608 (Implemented `FromStr` for `CString` and `TryFrom<CString>` for `String`)
 - rust-lang#130635 (Add `&pin (mut|const) T` type position sugar)
 - rust-lang#130747 (improve error messages for `C-cmse-nonsecure-entry` functions)
 - rust-lang#131137 (Add 1.82 release notes)
 - rust-lang#131328 (Remove unnecessary sorts in `rustc_hir_analysis`)
 - rust-lang#131496 (Stabilise `const_make_ascii`.)
 - rust-lang#131706 (Fix two const-hacks)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b9cb201 into rust-lang:master Oct 15, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Oct 15, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 15, 2024
Rollup merge of rust-lang#131328 - ismailarilik:remove-unnecessary-sorts-in-rustc-hir-analysis, r=compiler-errors

Remove unnecessary sorts in `rustc_hir_analysis`

A follow-up after rust-lang#131140. Here the related objects are `IndexSet` so do not require a sort to stay stable. And they don't need to be `mut` anymore.

r? ```@compiler-errors```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

6 participants