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

2020/08/21/golang-chan-byte-pool #89

Open
utterances-bot opened this issue Nov 10, 2020 · 3 comments
Open

2020/08/21/golang-chan-byte-pool #89

utterances-bot opened this issue Nov 10, 2020 · 3 comments

Comments

@utterances-bot
Copy link

Go语言|基于channel实现的并发安全的字节池 | 飞雪无情的博客

Go语言|基于channel实现的并发安全的字节池

https://www.flysnow.org/2020/08/21/golang-chan-byte-pool.html

Copy link

你好,请问为什么当文件小的时候(几M)基准测试会很久,甚至卡死,当文件大的时候(几百M),跟sync.pool比较却并没有优势

Copy link

博主问一个问题,你是使用chan来实现并非安全,有考虑过使用atomic来实现并非安全吗?chan在内部还是使用mutex来实现并非安全的

Copy link

这个测试代码太扯了,当你不理解原理的时候,不要随便测试,这个测试例子几乎不可能有归还池的可能,sync.pool的优势是频繁申请销毁,你都没搞懂,如果本地池没有,会尝试从其他池抢,导致调度过慢。所以你池子一直为空,根本发挥不了

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

4 participants