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

Simplify duplicate checks for mir validator #111917

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

WaffleLapkin
Copy link
Member

This removes unnecessary allocations & is less code.

@rustbot
Copy link
Collaborator

rustbot commented May 24, 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 May 24, 2023
@WaffleLapkin
Copy link
Member Author

r? @oli-obk

@rustbot rustbot assigned oli-obk and unassigned wesleywiser May 24, 2023
Comment on lines -1000 to +998
self.place_cache.push(place.as_ref());
has_duplicates |= !self.place_cache.insert(place.as_ref());
Copy link
Contributor

Choose a reason for hiding this comment

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

Here can just break from for when dupe found, but given that this is error only code path, probably doesn't matter.

@oli-obk
Copy link
Contributor

oli-obk commented May 25, 2023

I'm assuming a Vec was used out of perf concerns. Could use https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/sorted_map/struct.SortedMap.html instead to get similar behaviour.

But I don't think this is gonna cause perf issues either way (tho maybe check whether the original PR that added the code had any discussion on this)

@WaffleLapkin
Copy link
Member Author

@oli-obk I'm not sure how Vecs would be any better.

  • Previous impl for places used a hash set anyway, so it payed for collecting into a vec, and then copied everything to a newly created hash set.
  • Previous impl for values used a sort+dedup which also doesn't look any better than a hash set.

@oli-obk
Copy link
Contributor

oli-obk commented May 25, 2023

  • Previous impl for values used a sort+dedup which also doesn't look any better than a hash set.

it does at small sizes 😆 the hashset only pays off after a certain number of entries.

@wesleywiser
Copy link
Member

@bors try @rust-timer queue

@oli-obk
Copy link
Contributor

oli-obk commented Jul 6, 2023

@bors r+

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jul 6, 2023

📌 Commit cdaef2c has been approved by oli-obk

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 Jul 6, 2023
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 6, 2023
@bors
Copy link
Contributor

bors commented Jul 6, 2023

⌛ Testing commit cdaef2c with merge e96399e9a856d9600fea2b1e8af8708c246a9e39...

@WaffleLapkin
Copy link
Member Author

@bors r-

I think try by @wesleywiser/r+ by @oli-obk will get this insta-merged when the try build succeeds (the known bug in our bors), so I'll un-approve this until it's fully completed.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 6, 2023
@bors
Copy link
Contributor

bors commented Jul 6, 2023

☀️ Try build successful - checks-actions
Build commit: e96399e9a856d9600fea2b1e8af8708c246a9e39 (e96399e9a856d9600fea2b1e8af8708c246a9e39)

1 similar comment
@bors
Copy link
Contributor

bors commented Jul 6, 2023

☀️ Try build successful - checks-actions
Build commit: e96399e9a856d9600fea2b1e8af8708c246a9e39 (e96399e9a856d9600fea2b1e8af8708c246a9e39)

@rust-timer

This comment has been minimized.

@WaffleLapkin
Copy link
Member Author

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Jul 6, 2023

📌 Commit cdaef2c has been approved by oli-obk

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 6, 2023
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 6, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e96399e9a856d9600fea2b1e8af8708c246a9e39): 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)

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

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: 656.625s -> 658.283s (0.25%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 6, 2023
@oli-obk
Copy link
Contributor

oli-obk commented Jul 6, 2023

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jul 6, 2023

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Jul 6, 2023

📌 Commit cdaef2c has been approved by oli-obk

It is now in the queue for this repository.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 6, 2023
…li-obk

Simplify duplicate checks for mir validator

This removes unnecessary allocations & is less code.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 7, 2023
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#111917 (Simplify duplicate checks for mir validator)
 - rust-lang#112008 (Fix incorrect documented default bufsize in bufreader/writer)
 - rust-lang#112825 (Don't call `type_of` on TAIT in defining scope in new solver)
 - rust-lang#113164 (Add a regression test for rust-lang#109054)
 - rust-lang#113318 (Revert "alloc: Allow comparing Boxs over different allocators", add regression test)
 - rust-lang#113397 (Prefer object candidates in new selection)
 - rust-lang#113419 (Avoid calling item_name for RPITIT)
 - rust-lang#113421 (Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tys)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3aa4561 into rust-lang:master Jul 7, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jul 7, 2023
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.

7 participants