Skip to content

Conversation

@paolobarbolini
Copy link
Contributor

@paolobarbolini paolobarbolini commented Dec 6, 2025

Implements the idea in #148604 (comment).
Enhancement to #149694.

Could we get a perf run?

@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 Dec 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 6, 2025

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@Urgau
Copy link
Member

Urgau commented Dec 6, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Dec 6, 2025
@rust-bors

This comment has been minimized.

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

rust-bors bot commented Dec 6, 2025

☀️ Try build successful (CI)
Build commit: 3f3acdf (3f3acdfbe44242af2a9a5419227d7c20c118425e, parent: fbab541a7ad1c22fc51783d03c7d75fa577f5633)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3f3acdf): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.1% [0.1%, 0.2%] 3
Improvements ✅
(primary)
-1.1% [-1.1%, -1.1%] 1
Improvements ✅
(secondary)
-0.4% [-1.3%, -0.1%] 4
All ❌✅ (primary) -1.1% [-1.1%, -1.1%] 1

Max RSS (memory usage)

Results (secondary -2.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.1% [0.8%, 1.7%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.7% [-6.4%, -0.9%] 11
All ❌✅ (primary) - - 0

Cycles

Results (primary -3.2%, secondary 1.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.7% [2.1%, 6.6%] 7
Improvements ✅
(primary)
-3.2% [-3.2%, -3.2%] 1
Improvements ✅
(secondary)
-6.5% [-6.8%, -6.2%] 2
All ❌✅ (primary) -3.2% [-3.2%, -3.2%] 1

Binary size

Results (primary -0.1%, secondary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-1.1%, -0.0%] 30
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.0%] 23
All ❌✅ (primary) -0.1% [-1.1%, -0.0%] 30

Bootstrap: 471.701s -> 471.964s (0.06%)
Artifact size: 388.90 MiB -> 388.53 MiB (-0.09%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 6, 2025
@rustbot rustbot added the T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. label Dec 7, 2025
@rust-log-analyzer

This comment has been minimized.

@paolobarbolini
Copy link
Contributor Author

paolobarbolini commented Dec 7, 2025

Interesting perf results. Let's see what happens when we specialize on array and Vec iterators...

@Urgau: Could we do another perf run please?

I hope this is ok for you @lolbinarycat since it takes from #148604, #148604 (comment) and #149694

@Urgau
Copy link
Member

Urgau commented Dec 7, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Dec 7, 2025
@rust-bors

This comment has been minimized.

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

rust-bors bot commented Dec 7, 2025

💥 Test timed out after 21600s

@lolbinarycat
Copy link
Contributor

I would appreciate a Co-Authored-by field on the first commit if you could (git rebase -i then edit on that commit)

paolobarbolini and others added 2 commits December 10, 2025 04:18
@paolobarbolini
Copy link
Contributor Author

Could we run perf again? The previous attempt failed after the try build timed out.

@lolbinarycat
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Dec 10, 2025
@rust-bors
Copy link
Contributor

rust-bors bot commented Dec 10, 2025

☀️ Try build successful (CI)
Build commit: ed1b0fb (ed1b0fb66582f4a21549e973103af3f8652d8b66, parent: 198328ad7960b1bece0dc48496bff6c62dd5d339)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ed1b0fb): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.5% [0.3%, 0.8%] 3
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.0%] 6
All ❌✅ (primary) -0.4% [-0.4%, -0.4%] 1

Max RSS (memory usage)

Results (primary 0.0%, secondary -3.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.5% [3.5%, 3.5%] 1
Regressions ❌
(secondary)
0.9% [0.8%, 1.0%] 2
Improvements ✅
(primary)
-1.1% [-1.5%, -0.9%] 3
Improvements ✅
(secondary)
-4.4% [-6.9%, -1.6%] 10
All ❌✅ (primary) 0.0% [-1.5%, 3.5%] 4

Cycles

Results (secondary 3.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.4% [1.8%, 7.5%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-1.1%, -0.1%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-1.1%, -0.1%] 4

Bootstrap: 471.708s -> 474.648s (0.62%)
Artifact size: 389.07 MiB -> 388.75 MiB (-0.08%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 10, 2025
// SAFETY:
// - `val` is a valid &str, so `val.as_ptr()` is valid
// for `val.len()` bytes and properly initialized.
// - `spare` points to valid spare capacity in the Vec
Copy link
Member

Choose a reason for hiding this comment

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

This is unsound – it's possible to pass the same string multiple times (or overlapping strings), in which case this sum will saturate. But in that case, the capacity will not suffice here.

Copy link
Contributor

Choose a reason for hiding this comment

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

reserve will abort the program with an OOM error in that case, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, esp since no single allocation can be isize::MAX bytes large, reserve is guaranteed to fail if the sum saturates (in this case it will panic when it tries to calculate the new layout of the allocation, not OOM).

Comment on lines +2627 to +2633
let chunk = match iter.next_chunk::<8>() {
Ok(chunk) => chunk.into_iter(),
Err(partial_chunk) => {
repeat = false;
partial_chunk
}
};
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary for performance? Otherwise, I'd rather you use a loop and return instead of testing repeat.

@rustbot rustbot 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 Dec 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 16, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@lolbinarycat
Copy link
Contributor

note: #149694 has been accepted.

@bors
Copy link
Collaborator

bors commented Dec 30, 2025

☔ The latest upstream changes (presumably #149694) made this pull request unmergeable. Please resolve the merge conflicts.

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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants