New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
poor cStringIO.StringO seek performance #54254
Comments
cStringIO.StringO's seek method has O(n) characteristics in certain, When the file offset is set n bytes beyond the end of actual data, however, POSIX states that reads of data in the gap will return null bytes This patch for 2.7 corrects the behavior by unifying StringO and StringI's NOTE: Perhaps this seems like an extreme edge case not worthy of a fix, but |
The second sentence should have said "the gap is filled in with n null bytes" |
I'm changing the versions to just 2.7 (though I'm not sure this can be considered a bug fix), since StringIO is reimplemented as part of io in 3.x. |
I don't think there's much point in fixing this. 2.7 users can use io.BytesIO, which is a fast type implemented in C. |
Fair enough, but there is a great deal of existing code that already |
Causing perfectly good Python 2 applications to degrade in performance is bad, even if something else is available. This should be fixed as a regression. |
As far as I understand, this is not a regression. I don't think the cStringIO code has changed in years. |
Ok, reading more carefully, it's not a regression. But it's certainly a bug, and should be fixed. |
Right. The patch looks straightforward, but I'm not familiar with the |
Assigning to myself for review. |
Committed with minor changes in r85366 (release27-maint branch). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: