diff --git a/pool_test.go b/pool_test.go index f5171673b396656ecd3e8d2a999c11ea12e30dc2..1941144e94baf3cc68793bba0592ce208d4a007f 100644 --- a/pool_test.go +++ b/pool_test.go @@ -139,11 +139,27 @@ func BenchmarkPool(b *testing.B) { i = i << 1 } b := p.Get(i) + b[0] = byte(i) p.Put(b) } }) } +func BenchmarkAlloc(b *testing.B) { + b.RunParallel(func(pb *testing.PB) { + i := 7 + for pb.Next() { + if i > 1<<20 { + i = 7 + } else { + i = i << 1 + } + b := make([]byte, i) + b[1] = byte(i) + } + }) +} + func BenchmarkPoolOverlflow(b *testing.B) { var p BufferPool b.RunParallel(func(pb *testing.PB) {