introducing cbList to replace list.List #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
profile内存时发现,gaio内部用 list.List 来存放读者/写者的回调上下文,因此每次异步读写(写操作大部分情况就直接tryWrite成功了,所以更多情况是读操作)都会动态创建 list.Element 对象。
其实一般的应用,一个连接只会有1个读请求,或者若干个写请求,readers/writers 的数量相对较少,用slice就可以满足需求。这个PR用slice实现了 cbList 用来代替 list.List,以此优化内存分配次数较多的问题。