Skip to content

Conversation

@Amanieu
Copy link
Member

@Amanieu Amanieu commented Dec 17, 2025

#148937: Remove initialized-bytes tracking from BorrowedBuf and BorrowedCursor

This caused several performance regressions because of existing code which uses Read::read and therefore requires full buffer initialization. This is particularly a problem when the same buffer is re-used for multiple read calls since this means it needs to be fully re-initialized each time.

There is still some benefit to landing the API changes, but we will have to add private APIs so that the existing infrastructure can track and avoid redundant initialization.

…owedBuf` and `BorrowedCursor`)

This caused several performance regressions because of existing code
which uses `Read::read` and therefore requires full buffer
initialization. This is particularly a problem when the same buffer is
re-used for multiple read calls since this means it needs to be fully
re-initialized each time.

There is still some benefit to landing the API changes, but we will have
to add private APIs so that the existing infrastructure can
track and avoid redundant initialization.
@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 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2025

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@Amanieu Amanieu changed the title Revert: Remove initialized-bytes tracking from BorrowedBuf Revert #148937 Dec 17, 2025
@ChrisDenton
Copy link
Member

r? @ChrisDenton

r=me when PR CI passes

@ChrisDenton
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 17, 2025

📌 Commit 4b07875 has been approved by ChrisDenton

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 Dec 17, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 17, 2025
…sDenton

Revert rust-lang#148937

rust-lang#148937:  Remove initialized-bytes tracking from `BorrowedBuf` and `BorrowedCursor`

This caused several performance regressions because of existing code which uses `Read::read` and therefore requires full buffer initialization. This is particularly a problem when the same buffer is re-used for multiple read calls since this means it needs to be fully re-initialized each time.

There is still some benefit to landing the API changes, but we will have to add private APIs so that the existing infrastructure can track and avoid redundant initialization.
bors added a commit that referenced this pull request Dec 17, 2025
Rollup of 4 pull requests

Successful merges:

 - #149919 (Correctly encode doc attribute metadata)
 - #150051 (mir_build: Rename `TestCase` to `TestableCase`)
 - #150088 (miri: add `miri_spin_loop` to make `hint::spin_loop` work consistently)
 - #150096 (Revert #148937)

r? `@ghost`
`@rustbot` modify labels: rollup
@joshtriplett
Copy link
Member

👍 for landing this. I'll work on an updated version that does bool initialization tracking to avoid the redundant memsets.

@bors bors merged commit 92bd07b into rust-lang:main Dec 17, 2025
11 checks passed
rust-timer added a commit that referenced this pull request Dec 17, 2025
Rollup merge of #150096 - Amanieu:revert-borrowedbuf, r=ChrisDenton

Revert #148937

#148937:  Remove initialized-bytes tracking from `BorrowedBuf` and `BorrowedCursor`

This caused several performance regressions because of existing code which uses `Read::read` and therefore requires full buffer initialization. This is particularly a problem when the same buffer is re-used for multiple read calls since this means it needs to be fully re-initialized each time.

There is still some benefit to landing the API changes, but we will have to add private APIs so that the existing infrastructure can track and avoid redundant initialization.
@rustbot rustbot added this to the 1.94.0 milestone Dec 17, 2025
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Dec 18, 2025
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#149919 (Correctly encode doc attribute metadata)
 - rust-lang/rust#150051 (mir_build: Rename `TestCase` to `TestableCase`)
 - rust-lang/rust#150088 (miri: add `miri_spin_loop` to make `hint::spin_loop` work consistently)
 - rust-lang/rust#150096 (Revert rust-lang/rust#148937)

r? `@ghost`
`@rustbot` modify labels: rollup
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-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.

5 participants