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

Inline __iterator_get_unchecked for some iterator adapters. #92566

Merged
merged 2 commits into from
May 3, 2022

Conversation

the8472
Copy link
Member

@the8472 the8472 commented Jan 5, 2022

This aligns the inline attributes of existing __iterator_get_unchecked with those of next() on adapters that have both.

It improves the performance of iterators using unchecked access when building in incremental mode (due to the larger CGU count?). It might negatively affect incremental compile times for better runtime results, but considering that the equivalent next() implementations also are #[inline] and usually are more complex this should be ok.

./x.py bench library/core -i --stage 0 --test-args bench_trusted_random_access

OLD: 119,172 ns/iter
NEW:  17,714 ns/iter

@rust-highfive
Copy link
Collaborator

r? @m-ou-se

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 5, 2022
@the8472 the8472 force-pushed the inline-tra branch 2 times, most recently from 5bd8a31 to 4f3fafa Compare January 5, 2022 01:43
@nrc nrc added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jan 6, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 23, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 27, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 20, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 24, 2022
@JohnTitor
Copy link
Member

The result on the OP looks neat to me, is it worth running a perf-check?

@m-ou-se
Copy link
Member

m-ou-se commented May 2, 2022

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented May 2, 2022

📌 Commit 4f3fafa077a95748cac75f6247eb2ae2fd0cf97c has been approved by m-ou-se

@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 May 2, 2022
@bors
Copy link
Contributor

bors commented May 2, 2022

⌛ Testing commit 4f3fafa077a95748cac75f6247eb2ae2fd0cf97c with merge 51205365b7eb58544dcf212d26028dfe2e7a587c...

@bors
Copy link
Contributor

bors commented May 2, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 2, 2022
@rust-log-analyzer

This comment has been minimized.

…ed` with those of `next()` on adapters that have both.

It improves the performance of iterators using unchecked access when building in incremental mode
(due to the larger CGU count?). It might negatively affect incremental compile times for better runtime results,
but considering that the equivalent `next()` implementations also are `#[inline]` and usually are more complex this
should be ok.

```
./x.py bench library/core -i --stage 0 --test-args bench_trusted_random_access

OLD: 119,172 ns/iter
NEW:  17,714 ns/iter
```
@the8472
Copy link
Member Author

the8472 commented May 2, 2022

The bench-executed-as-test overflowed an usize on a 32bit build with overflow checks. It now uses wrapping_add instead to avoid that since the computed results are not relevant to the benchmark, it's just exercising the adapters.

I'll go ahead and assume that that fix is tiny enough that doesn't need a new review.

@bors r=m-ou-se rollup=never

@bors
Copy link
Contributor

bors commented May 2, 2022

📌 Commit a68a5d2 has been approved by m-ou-se

@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 May 2, 2022
@bors
Copy link
Contributor

bors commented May 2, 2022

⌛ Testing commit a68a5d2 with merge 3d0ac7e...

@bors
Copy link
Contributor

bors commented May 3, 2022

☀️ Test successful - checks-actions
Approved by: m-ou-se
Pushing 3d0ac7e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 3, 2022
@bors bors merged commit 3d0ac7e into rust-lang:master May 3, 2022
@rustbot rustbot added this to the 1.62.0 milestone May 3, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3d0ac7e): comparison url.

Summary:

  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 1 2 3 1 4
mean2 0.2% 0.3% -0.4% -0.2% -0.2%
max 0.2% 0.3% -0.4% -0.2% -0.4%

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

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

@rustbot rustbot added the perf-regression Performance regression. label May 3, 2022
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. perf-regression Performance regression. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants