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

Proposal: grow buffers more efficiently #679

Open
bboreham opened this issue Jun 20, 2023 · 0 comments
Open

Proposal: grow buffers more efficiently #679

bboreham opened this issue Jun 20, 2023 · 0 comments

Comments

@bboreham
Copy link
Contributor

json-iterator is using append in many places to grow a buffer, e.g.:

go/stream.go

Line 68 in 71ac162

stream.buf = append(stream.buf, p...)

return append(buf, byte(v>>16), byte(v>>8), byte(v))

As noted at golang/go#50774, append is designed to minimize space wasted at the end of the buffer, whereas most people using json-iterator probably want to optimise for minimum CPU usage.

I can make a PR, but posting this as an issue first to get feedback.

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

No branches or pull requests

1 participant