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

Replace usages of vec![].into_iter with [].into_iter #92070

Merged

Conversation

rukai
Copy link
Contributor

@rukai rukai commented Dec 18, 2021

[].into_iter is idiomatic over vec![].into_iter because its simpler and faster (unless the vec is optimized away in which case it would be the same)

So we should change all the implementation, documentation and tests to use it.

I skipped:

  • src/tools - Those are copied in from upstream
  • src/test/ui - Hard to tell if vec![].into_iter was used intentionally or not here and not much benefit to changing it.
  • any case where vec![].into_iter was used because we specifically needed a Vec::IntoIter<T>
  • any case where it looked like we were intentionally using vec![].into_iter to test it.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 18, 2021
@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive
Copy link
Collaborator

⚠️ Warning ⚠️

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 18, 2021
@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue to confirm perf is not worse (I expect roughly neutral to slight improvement, most likely)

Thanks!

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 18, 2021
@bors
Copy link
Contributor

bors commented Dec 18, 2021

⌛ Trying commit d04936a8a3d12e310d82d6cec02105b9b9712a65 with merge 321070819ae6a777a2fcf631205d23c330f693ad...

@rust-log-analyzer

This comment has been minimized.

@rukai
Copy link
Contributor Author

rukai commented Dec 18, 2021

Thanks!
I'll investigate the test failures tomorrow, its a bit late over here.

@bors
Copy link
Contributor

bors commented Dec 18, 2021

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

@rust-timer
Copy link
Collaborator

Queued 321070819ae6a777a2fcf631205d23c330f693ad with parent d3f3004, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (321070819ae6a777a2fcf631205d23c330f693ad): comparison url.

Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.

  • Moderate improvement in instruction counts (up to -0.9% on incr-unchanged builds of externs)
  • Small regression in instruction counts (up to 1.8% on incr-patched: println builds of regression-31157)

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 @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 18, 2021
@rukai rukai force-pushed the replace_vec_into_iter_with_array_into_iter branch from d04936a to 9885398 Compare December 18, 2021 23:54
@rukai
Copy link
Contributor Author

rukai commented Dec 18, 2021

The build failures look like they will all be resolved by #92068 so i'll put this PR on hold until that lands.

Not sure how the benchmarks successfully ran when the PR doesnt even build.
Does it maybe not use the std/core from my PR?

@rust-log-analyzer

This comment has been minimized.

@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

mingw-check looks to be failing due to tests not building, which are not required to produce artifacts for try builds. Going to rerun the perf build since it looks like it might've been a little bit due to noise.

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 5, 2022
@bors
Copy link
Contributor

bors commented Jan 5, 2022

⌛ Trying commit 988539835929405f9b233ab5b17ed149bc9ce6f3 with merge f5a08fefa57a109a7b8253b284666479011847b4...

@bors
Copy link
Contributor

bors commented Jan 5, 2022

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

@rust-timer
Copy link
Collaborator

Queued f5a08fefa57a109a7b8253b284666479011847b4 with parent 5883b87, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f5a08fefa57a109a7b8253b284666479011847b4): comparison url.

Summary: This benchmark run did not return any relevant changes.

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
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Jan 5, 2022
@rukai rukai force-pushed the replace_vec_into_iter_with_array_into_iter branch 4 times, most recently from 37b9e61 to 478c13b Compare January 9, 2022 02:18
@rust-log-analyzer

This comment has been minimized.

@rukai rukai force-pushed the replace_vec_into_iter_with_array_into_iter branch from 478c13b to 0882985 Compare January 9, 2022 03:09
@rukai
Copy link
Contributor Author

rukai commented Jan 9, 2022

Alright, this PR is ready for review again.

@Mark-Simulacrum
Copy link
Member

Thanks -- this looks great to me now.

@bors r+

@bors
Copy link
Contributor

bors commented Jan 10, 2022

📌 Commit 0882985 has been approved by Mark-Simulacrum

@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 Jan 10, 2022
@klensy
Copy link
Contributor

klensy commented Jan 10, 2022

Is there clippy lint for this? If no, maybe you create suggestion to add it?

@bors
Copy link
Contributor

bors commented Jan 11, 2022

⌛ Testing commit 0882985 with merge 2e2c86e...

@bors
Copy link
Contributor

bors commented Jan 11, 2022

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 2e2c86e to master...

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2e2c86e): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

8 participants