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

Avoid redundant bytes -> string -> bytes conversion on reading #73

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

vbanos
Copy link
Contributor

@vbanos vbanos commented Feb 2, 2025

The current version uses ReadString and then converts to []bytes when appending to line.
We can use ReadBytes directly and avoid that, improving performance. bufio.reader supports it https://pkg.go.dev/bufio#Reader.ReadBytes

Also, the append call is duplicate and can be called once.

The current version uses `ReadString` and then converts to `[]bytes`
when appending to `line`.
We can use `ReadBytes` directly and avoid that, improving performance.
`bufio.reader` supports it https://pkg.go.dev/bufio#Reader.ReadBytes

Also, the `append` call is duplicate and can be called once.
Copy link
Owner

@CorentinB CorentinB left a comment

Choose a reason for hiding this comment

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

LGTM

@CorentinB CorentinB merged commit fdb0696 into CorentinB:master Feb 2, 2025
1 check passed
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