-
Notifications
You must be signed in to change notification settings - Fork 269
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
feat: use sync.Pool to reduce alloc #729
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: yuanliang <yuanliang_zh@163.com>
Hi @ethan256, do you have some real-world motivation for wanting to introduce a pool? |
|
Signed-off-by: yuanliang <yuanliang_zh@163.com>
@danomagnum is this something the server could benefit from as well? |
I would think so. I'd have to check but it may automatically benefit from this to some extent since it uses the uasc module already. |
Could you have a look @danomagnum ? Then I'll merge it to v0.6.1 |
I'd like to see a bit more research into whether or not this is needed. |
I remember |
Hey @kung-foo , my keybase account got blocked when my laptop and phone got stolen. Can you send me an email to re-connect? Check your inbox. Sent you something to your github email account. |
I took a look at it and there are a couple places it would as currently implemented impact the server. Mostly the readChunk function. I agree on needing more investigation though to make sure we don't leak any slice references that would then get put back in the pool and re-used while not actually free. The other encoding performance pull request (#726) seems like a better first approach to me and (without actually looking into it) I don't see why you couldn't combine them eventually - using a pool of streams instead of a pool of buffers. |
I agree with this, there are indeed some non-free slice being put back into the pool. Further testing and analysis is needed. |
use
sync.Pool
to reduce alloc onconn.Receive
.