MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / BenchmarkBytePool_Copy_Bytes_32

Function BenchmarkBytePool_Copy_Bytes_32

internal/utils/byte_pool_test.go:230–249  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

228}
229
230func 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
251func BenchmarkBytePool_Copy_Wrapper_32(b *testing.B) {
252 const size = 32 << 10

Callers

nothing calls this directly

Calls 3

NextMethod · 0.80
GetMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected