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

Add slice::DrainRaw for internal use #127348

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

scottmcm
Copy link
Member

@scottmcm scottmcm commented Jul 5, 2024

I'd like to separate out this hopefully-non-controversial part of #124421 to have fewer commits to juggle there :)

r? @the8472

Rather than encoding things as method calls or token expansions.

This isn't directly useful for Iter/IterMut, but sets this up for the next commit that adds another invocation of the macro.
@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 Jul 5, 2024
@scottmcm
Copy link
Member Author

scottmcm commented Jul 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 Jul 5, 2024
@bors
Copy link
Contributor

bors commented Jul 5, 2024

⌛ Trying commit 3f38556 with merge 2132470...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 5, 2024
Add `slice::DrainRaw` for internal use

I'd like to separate out this hopefully-non-controversial part of rust-lang#124421 to have fewer commits to juggle there :)

r? `@the8472`
@bors
Copy link
Contributor

bors commented Jul 5, 2024

☀️ Try build successful - checks-actions
Build commit: 2132470 (213247063d14960f8b256772f274b288657fb599)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2132470): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.

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-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.5% [0.3%, 1.0%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.7%, -0.3%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.7%, 1.0%] 6

Max RSS (memory usage)

Results (primary 2.9%, secondary 0.0%)

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)
4.1% [2.0%, 7.3%] 8
Regressions ❌
(secondary)
0.8% [0.7%, 0.8%] 2
Improvements ✅
(primary)
-2.3% [-2.5%, -2.2%] 2
Improvements ✅
(secondary)
-0.7% [-0.8%, -0.6%] 2
All ❌✅ (primary) 2.9% [-2.5%, 7.3%] 10

Cycles

Results (primary 1.3%, secondary 0.7%)

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)
1.3% [1.3%, 1.3%] 1
Regressions ❌
(secondary)
1.4% [0.6%, 2.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-0.7%, -0.7%] 1
All ❌✅ (primary) 1.3% [1.3%, 1.3%] 1

Binary size

Results (primary 0.0%, secondary -0.3%)

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.2% [0.0%, 0.7%] 42
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.7%, -0.1%] 17
Improvements ✅
(secondary)
-0.3% [-0.8%, -0.1%] 6
All ❌✅ (primary) 0.0% [-0.7%, 0.7%] 59

Bootstrap: 698.879s -> 701.919s (0.43%)
Artifact size: 328.27 MiB -> 328.37 MiB (0.03%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 5, 2024
Copy link
Member

@the8472 the8472 left a comment

Choose a reason for hiding this comment

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

Looks ok overall. The PR description could contain a bit of motivation, since that goes into the git history.

Also, I was not even aware of array::Drain. Once the alloc types get migrated that'll be more reasonable but right now it looks like quite a rube-goldberg machine to implement array::try_map 😅

Copy link
Member

Choose a reason for hiding this comment

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

This file contains a bunch of references to vec::IntoIter, with the current state that's confusing. Maybe refer to array::Drain instead?

Comment on lines +150 to +155
let len = self.len();
let clamped = len.min(N);

// SAFETY: By construction, `clamped` is always in-bounds.
let to_copy = unsafe { self.0.skip_forward_unchecked(clamped) };
if len >= N {
Copy link
Member

Choose a reason for hiding this comment

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

Is the mix of len and clamped intentional?

@the8472 the8472 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-review Status: Awaiting review from the assignee but also interested parties. labels Aug 6, 2024
@the8472
Copy link
Member

the8472 commented Aug 26, 2024

ping @scottmcm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

5 participants