Skip to content

Commit

Permalink
Refactor: bufferpool new function (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
xjasonlyu authored Sep 22, 2024
1 parent 428f826 commit 5678651
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions transport/internal/bufferpool/bufferpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import (
const _size = 1024 // by default, create 1 KiB buffers

var _pool = pool.New(func() *bytes.Buffer {
buf := &bytes.Buffer{}
buf.Grow(_size)
return buf
return bytes.NewBuffer(make([]byte, 0, _size))
})

func Get() *bytes.Buffer {
Expand Down

0 comments on commit 5678651

Please sign in to comment.