Skip to content

Conversation

@cmaloney
Copy link
Contributor

@cmaloneycmaloney 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

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinnervstinner merged commit e1c4ba9 into python:mainJan 30, 2025
39 checks passed
@cmaloneycmaloney 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
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@cmaloney@vstinner