Skip to content

Conversation

@a1phyr
Copy link
Contributor

@a1phyr a1phyr commented Dec 18, 2025

This PR changes uninitialized bytes tracking in BorrowedBuf from being byte-wise to being buffer-wise.

I've put all the API around init a new unstable feature borrowed_buf_init, to split the part that needs it and the part that doesn't. It will avoids accidental stabilization of this part.

I'm not really convinced of the rename of advance_unchecked to advance, but I did it anyway. The old advance was kept as advance_checked.

Alternative of #148937

Cc #78485 #117693
Cc @joshtriplett

r? @Amanieu

@rustbot rustbot added O-SGX Target: SGX O-windows Operating system: Windows 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 18, 2025
@rust-log-analyzer

This comment has been minimized.

@joshtriplett
Copy link
Member

joshtriplett commented Dec 18, 2025

The old advance was kept as advance_checked.

As far as I can tell, if we keep that API in any form, that commits us to always having initialization tracking. I don't think there's any way to have an advance_checked operation if we eventually drop initialization tracking entirely.

EDIT: That's fully addressed by keeping advance_checked under the separate borrowed_buf_init, which I'm hoping we never stabilize, and eventually remove.

@joshtriplett
Copy link
Member

@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 20, 2025
`BorrowedCursor`: make `init` a boolean
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 20, 2025
@rust-bors
Copy link

rust-bors bot commented Dec 20, 2025

☀️ Try build successful (CI)
Build commit: 1aaa6a2 (1aaa6a2263b7828878aab80329e328a476e73beb, parent: 9044e98b66d074e7f88b1d4cea58bb0538f2eda6)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1aaa6a2): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

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.

@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.1%] 1
Improvements ✅
(primary)
-0.4% [-0.6%, -0.3%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-0.6%, -0.3%] 2

Max RSS (memory usage)

Results (primary -3.9%)

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)
-3.9% [-4.0%, -3.9%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.9% [-4.0%, -3.9%] 2

Cycles

Results (primary 2.6%)

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

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

Binary size

Results (primary -0.2%, 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.2% [-0.5%, -0.0%] 6
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) -0.2% [-0.5%, -0.0%] 6

Bootstrap: 478.41s -> 476.787s (-0.34%)
Artifact size: 390.55 MiB -> 390.57 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-SGX Target: SGX O-windows Operating system: Windows 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants