Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

gh-129005: _pyio.BufferedIO remove copy on readall #129454

Merged
merged 3 commits into from
Jan 30, 2025

Conversation

cmaloney
Copy link
Contributor

@cmaloney cmaloney commented Jan 29, 2025

Slicing buf and appending chunk would always result in a copy / another memory allocation of the length of chunk. Commonly in a readall there is no already read data in buf, and the amount of data read may be large, so the copy is expensive.

Slicing buf and appending chunk would always result in a copy. Commonly
in a readall there is no already read data in buf, and the amount of
data read may be large, so the copy is expensive.
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinner vstinner enabled auto-merge (squash) January 30, 2025 10:55
@vstinner vstinner merged commit e1c4ba9 into python:main Jan 30, 2025
39 checks passed
@cmaloney cmaloney deleted the cmaloney/pyio_bufio_copy branch January 30, 2025 21:58
cmaloney added a commit to cmaloney/cpython that referenced this pull request Jan 31, 2025
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Feb 7, 2025
Slicing buf and appending chunk would always result in a copy. Commonly
in a readall() there is no already read data in buf, and the amount of
data read may be large, so the copy is expensive.
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Feb 7, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants