Add lazy headroom

This commit is contained in:
世界 2022-10-07 20:12:20 +08:00
parent c4e9bf11fa
commit ec72b91c12
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 51 additions and 18 deletions

View file

@ -88,10 +88,7 @@ type NetVectorisedWriterWrapper struct {
func (w *NetVectorisedWriterWrapper) WriteVectorised(buffers []*buf.Buffer) error {
defer buf.ReleaseMulti(buffers)
netBuffers := make(net.Buffers, 0, len(buffers))
for _, buffer := range buffers {
netBuffers = append(netBuffers, buffer.Bytes())
}
netBuffers := net.Buffers(buf.ToSliceMulti(buffers))
return common.Error(netBuffers.WriteTo(w.upstream))
}