common/buf/buffer.go: Replace copy zero with clear() #5071
Merged
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.
唯一会增加性能的地方 其他panic我看了一下绝大多数都以数组越界的形式出现 没必要加有的没的
至于writeString节省拷贝开销我自己写了一个确实可以节省的版本 没有观测到肉眼可见的变化 而且脑测需要单次写入极大的数据才会形成差距 但凡跟一下都会发现这个东西一般都是写一些控制信息 或者非常短的玩意(比如http/1.1里的换行符) 不参与高强度热循环