Skip to content

Commit

Permalink
fix: fix slice init length (uber-go#1461)
Browse files Browse the repository at this point in the history
Signed-off-by: cuishuang <imcusg@gmail.com>
  • Loading branch information
cuishuang committed Aug 27, 2024
1 parent 5786471 commit f87c7be
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 f87c7be

Please sign in to comment.