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

Go runtime adoption #9

Open
jadbox opened this issue Jul 10, 2016 · 2 comments
Open

Go runtime adoption #9

jadbox opened this issue Jul 10, 2016 · 2 comments

Comments

@jadbox
Copy link

jadbox commented Jul 10, 2016

I was thinking- couldn't Go perform pooling for byte arrays natively and implicitly? Thought I'd bring it up here if this sounds like a logical optimization the runtime could perform.

@valyala
Copy link
Owner

valyala commented Jul 12, 2016

It's very difficult to implement byte buffer pooling that satisfies all the needs. butebufferpool isn't a silver bullet yet.

It performs better than a dumb sync.Pool when working with variously-sized byte buffers when a small fraction of such buffers has much higher size comparing to the rest (this helps real-world apps based on fasthttp and quicktemplate).

But it still may waste a lot of memory in the case of buffers with wide-range equally distributed sizes. It is advisable to create a separate pool per each use in this case - see Pool docs for details.

@jjhesk
Copy link

jjhesk commented Feb 23, 2019

@valyala i have the exact situation from your comment, any chance that you can show me some example how to get it done?

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

No branches or pull requests

3 participants