(b *testing.B)
| 144 | } |
| 145 | |
| 146 | func BenchmarkBytePool_Copy_Bytes_16(b *testing.B) { |
| 147 | const size = 16 << 10 |
| 148 | |
| 149 | var data = bytes.Repeat([]byte{'A'}, size) |
| 150 | |
| 151 | var pool = &sync.Pool{ |
| 152 | New: func() any { |
| 153 | return make([]byte, size) |
| 154 | }, |
| 155 | } |
| 156 | b.ResetTimer() |
| 157 | |
| 158 | b.RunParallel(func(pb *testing.PB) { |
| 159 | for pb.Next() { |
| 160 | var buf = pool.Get().([]byte) |
| 161 | copy(buf, data) |
| 162 | pool.Put(buf) |
| 163 | } |
| 164 | }) |
| 165 | } |
| 166 | |
| 167 | func BenchmarkBytePool_Copy_Wrapper_16(b *testing.B) { |
| 168 | const size = 16 << 10 |