give the bytes.Buffer a preallocated slice to use for less variance

This commit is contained in:
Cassondra Foesch 2021-03-17 20:18:50 +00:00
parent 91163e4463
commit addaabd30b
1 changed files with 1 additions and 1 deletions

View File

@ -2473,7 +2473,7 @@ func benchmarkWriteTo(b *testing.B, bufsize int, delay time.Duration) {
f.Write(data)
f.Close()
buf := new(bytes.Buffer)
buf := bytes.NewBuffer(make([]byte, 0, size))
b.ResetTimer()
b.SetBytes(int64(size))