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

Rewrite Iterator::position default impl #119599

Merged
merged 1 commit into from Jan 7, 2024
Merged

Conversation

marthadev
Copy link
Contributor

Storing the accumulating value outside the fold in an attempt to improve code generation has shown speedups on various handwritten benchmarks, see discussion at #119551.

@rustbot
Copy link
Collaborator

rustbot commented Jan 5, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 5, 2024
@the8472
Copy link
Member

the8472 commented Jan 5, 2024

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

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

bors commented Jan 5, 2024

⌛ Trying commit fd33955 with merge 5139266...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 5, 2024
Rewrite Iterator::position default impl

Storing the accumulating value outside the fold in an attempt to improve code generation has shown speedups on various handwritten benchmarks, see discussion at rust-lang#119551.
@bors
Copy link
Contributor

bors commented Jan 5, 2024

☀️ Try build successful - checks-actions
Build commit: 5139266 (51392669857c5149d54ed2da5cb1628a5197d7d4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5139266): comparison URL.

Overall result: ✅ improvements - 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 is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-0.5%, -0.5%] 1

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.4% [3.4%, 3.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.6% [-4.7%, -2.6%] 2
All ❌✅ (primary) 3.4% [3.4%, 3.4%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-2.8%, -2.0%] 5
All ❌✅ (primary) - - 0

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 1

Bootstrap: 670.544s -> 670.096s (-0.07%)
Artifact size: 311.06 MiB -> 311.06 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 5, 2024
@the8472 the8472 assigned the8472 and unassigned Mark-Simulacrum Jan 5, 2024
@the8472
Copy link
Member

the8472 commented Jan 5, 2024

Nice, no regressions and your benchmarks look good too.

Are you willing to try your hand at writing a codegen test based on the llvm ir difference #119551 (comment) ?
It's optional, I'd approve the PR without that too.

@marthadev
Copy link
Contributor Author

Are you willing to try your hand at writing a codegen test based on the llvm ir difference #119551 (comment) ? It's optional, I'd approve the PR without that too.

I have no experience in writing codegen tests, and I sadly don't really have the time to learn about it right now. I will look into manually retesting when there are relevant changes to the ControlFlow enum, but for now this is all I can do.

@the8472
Copy link
Member

the8472 commented Jan 5, 2024

Ok, that's fine. Can you squash your commits since the first one doesn't build?

…g the accumulating value outside of the fold in an attempt to improve code generation

Squashed with: Add inheriting overflow checks back
@marthadev
Copy link
Contributor Author

Ok, that's fine. Can you squash your commits since the first one doesn't build?

Should be fine now

@the8472
Copy link
Member

the8472 commented Jan 5, 2024

Thanks.

@bors r+

@bors
Copy link
Contributor

bors commented Jan 5, 2024

📌 Commit 0e9c3d9 has been approved by the8472

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 Jan 5, 2024
@the8472 the8472 linked an issue Jan 5, 2024 that may be closed by this pull request
@bors
Copy link
Contributor

bors commented Jan 6, 2024

⌛ Testing commit 0e9c3d9 with merge 9a56082...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 6, 2024
Rewrite Iterator::position default impl

Storing the accumulating value outside the fold in an attempt to improve code generation has shown speedups on various handwritten benchmarks, see discussion at rust-lang#119551.
@bors
Copy link
Contributor

bors commented Jan 6, 2024

💥 Test timed out

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 6, 2024
@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 6, 2024
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@the8472
Copy link
Member

the8472 commented Jan 6, 2024

The apple builder was hanging while building LLVM, that should be unrelated to this change.

@bors retry

@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 6, 2024
@bors
Copy link
Contributor

bors commented Jan 6, 2024

⌛ Testing commit 0e9c3d9 with merge fde0e98...

@bors
Copy link
Contributor

bors commented Jan 7, 2024

☀️ Test successful - checks-actions
Approved by: the8472
Pushing fde0e98 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 7, 2024
@bors bors merged commit fde0e98 into rust-lang:master Jan 7, 2024
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 7, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (fde0e98): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-0.5%, -0.5%] 1

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.9% [2.9%, 2.9%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.4% [-3.8%, -3.0%] 2
All ❌✅ (primary) 2.9% [2.9%, 2.9%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.6% [2.0%, 3.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-8.1% [-8.1%, -8.1%] 1
All ❌✅ (primary) - - 0

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 1

Bootstrap: 668.367s -> 667.404s (-0.14%)
Artifact size: 308.49 MiB -> 308.54 MiB (0.02%)

@marthadev marthadev deleted the position branch February 8, 2024 16:41
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-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.

Iterator Default Implementation for position() is slow
7 participants