Skip to content
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

Switch to non-buffering byte reader #33

Merged
merged 1 commit into from
Aug 6, 2020

Conversation

Stebalien
Copy link
Collaborator

@Stebalien Stebalien commented Aug 5, 2020

Buffering could lead to reading over the end of the object, corrupting the next object. We weren't running into this in practice because we're using bytes.Buffer everywhere (so we were never hitting the bufio code path, as far as I can tell).

This patch also gets rid of "PeekByte" and uses the standard ReadByte/UnreadByte interfaces. That way, we can avoid wrapping the byte reader in the happy path, saving some overhead.

Note: this is an API (but not format) breaking change. Generated files will have to be re-generated.

Buffering could lead to reading over the end of the object, corrupting the next object.

This patch also gets rid of "PeekByte" and uses the standard ReadByte/UnreadByte
interfaces. That way, we can avoid wrapping the byte reader in the happy path,
saving some overhead.
@Stebalien Stebalien mentioned this pull request Aug 5, 2020
@whyrusleeping whyrusleeping merged commit 021bda1 into whyrusleeping:master Aug 6, 2020
Sign up for free to 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