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

workers 使用slice 还是list问题 #3

Closed
barryz opened this issue Jul 25, 2018 · 2 comments · Fixed by #4
Closed

workers 使用slice 还是list问题 #3

barryz opened this issue Jul 25, 2018 · 2 comments · Fixed by #4
Labels
question Further information is requested

Comments

@barryz
Copy link
Contributor

barryz commented Jul 25, 2018

看了下代码, Pool是用slice来装workers, 但Pool的操作中,除了purge和release中需要遍历workers, getWorker和putWorker 都是对队尾出队入队的操作, 是否可以考虑用 container/list ? (假设,还没验证)。

另外还有个问题, 在putWokers时有个append操作, 这里是不是可以在NewPool时, 给workers slice 预分配一些空间呢?

@barryz
Copy link
Contributor Author

barryz commented Jul 25, 2018

container/list 这个我可以替换测试下 🛩

@panjf2000
Copy link
Owner

链表的性能会比较好吗?我没测试过,你可以改一下测一下,如果性能的确有提升可以提个PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants