From f87c7be57ccc7ab7a0aa3fbc12398369fe3a61c3 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Wed, 28 Aug 2024 02:04:55 +0800 Subject: [PATCH] fix: fix slice init length (#1461) Signed-off-by: cuishuang --- buffer/buffer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buffer/buffer_test.go b/buffer/buffer_test.go index 71ffac114..9f0091a0f 100644 --- a/buffer/buffer_test.go +++ b/buffer/buffer_test.go @@ -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) {