Skip to content

Uses strings.Builder instead of []byte in iter.ReadString #526

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cyriltovena
Copy link

This is to avoid allocations, also fixes tests still not working with go1.15.

Signed-off-by: Cyril Tovena cyril.tovena@gmail.com

This is to avoid allocations, also fixes tests still not working with go1.15.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
@zeripath
Copy link

zeripath commented Mar 1, 2021

Whilst a string.Builder can reduce allocations it may actually be better to keep a small buffer or the builder around in order to reduce allocs further.

@cyriltovena
Copy link
Author

Whilst a string.Builder can reduce allocations it may actually be better to keep a small buffer or the builder around in order to reduce allocs further.

Yes that sounds good.

@funny-falcon
Copy link

json-iterator already relies on unsafe reflect2 package. Than why no simply cast byte slice to string using unsafe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants