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

Function BenchmarkBytePool_Copy_Wrapper_16

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

Source from the content-addressed store, hash-verified

165}
166
167func BenchmarkBytePool_Copy_Wrapper_16(b *testing.B) {
168 const size = 16 << 10
169
170 var data = bytes.Repeat([]byte{'A'}, size)
171
172 var pool = &sync.Pool{
173 New: func() any {
174 return &utils.BytesBuf{
175 Bytes: make([]byte, size),
176 }
177 },
178 }
179 b.ResetTimer()
180
181 b.RunParallel(func(pb *testing.PB) {
182 for pb.Next() {
183 var buf = pool.Get().(*utils.BytesBuf)
184 copy(buf.Bytes, data)
185 pool.Put(buf)
186 }
187 })
188}
189
190func BenchmarkBytePool_Copy_Wrapper_Buf_16(b *testing.B) {
191 const size = 16 << 10

Callers

nothing calls this directly

Calls 3

NextMethod · 0.80
GetMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected