(b *testing.B)
| 249 | } |
| 250 | |
| 251 | func BenchmarkBytePool_Copy_Wrapper_32(b *testing.B) { |
| 252 | const size = 32 << 10 |
| 253 | |
| 254 | var data = bytes.Repeat([]byte{'A'}, size) |
| 255 | |
| 256 | var pool = &sync.Pool{ |
| 257 | New: func() any { |
| 258 | return &utils.BytesBuf{ |
| 259 | Bytes: make([]byte, size), |
| 260 | } |
| 261 | }, |
| 262 | } |
| 263 | b.ResetTimer() |
| 264 | |
| 265 | b.RunParallel(func(pb *testing.PB) { |
| 266 | for pb.Next() { |
| 267 | var buf = pool.Get().(*utils.BytesBuf) |
| 268 | copy(buf.Bytes, data) |
| 269 | pool.Put(buf) |
| 270 | } |
| 271 | }) |
| 272 | } |