Skip to content

Commit

Permalink
fix: fix slice init length
Browse files Browse the repository at this point in the history
Signed-off-by: cuishuang <[email protected]>
  • Loading branch information
cuishuang committed Aug 22, 2024
1 parent 5786471 commit 2ed88d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion buffer/buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func BenchmarkBuffers(b *testing.B) {
// bunch of extra allocations). Nevertheless, let's make sure that we're
// not losing any precious nanoseconds.
str := strings.Repeat("a", 1024)
slice := make([]byte, 1024)
slice := make([]byte, 0, 1024)
buf := bytes.NewBuffer(slice)
custom := NewPool().Get()
b.Run("ByteSlice", func(b *testing.B) {
Expand Down

0 comments on commit 2ed88d1

Please sign in to comment.