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

Function BenchmarkBytePool_Copy_Wrapper_32

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

Source from the content-addressed store, hash-verified

249}
250
251func 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}

Callers

nothing calls this directly

Calls 3

NextMethod · 0.80
GetMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected