(b *testing.B)
| 228 | } |
| 229 | |
| 230 | func BenchmarkBytePool_Copy_Bytes_32(b *testing.B) { |
| 231 | const size = 32 << 10 |
| 232 | |
| 233 | var data = bytes.Repeat([]byte{'A'}, size) |
| 234 | |
| 235 | var pool = &sync.Pool{ |
| 236 | New: func() any { |
| 237 | return make([]byte, size) |
| 238 | }, |
| 239 | } |
| 240 | b.ResetTimer() |
| 241 | |
| 242 | b.RunParallel(func(pb *testing.PB) { |
| 243 | for pb.Next() { |
| 244 | var buf = pool.Get().([]byte) |
| 245 | copy(buf, data) |
| 246 | pool.Put(buf) |
| 247 | } |
| 248 | }) |
| 249 | } |
| 250 | |
| 251 | func BenchmarkBytePool_Copy_Wrapper_32(b *testing.B) { |
| 252 | const size = 32 << 10 |