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

Function BenchmarkBytePool_Copy_Bytes_16

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

Source from the content-addressed store, hash-verified

144}
145
146func BenchmarkBytePool_Copy_Bytes_16(b *testing.B) {
147 const size = 16 << 10
148
149 var data = bytes.Repeat([]byte{'A'}, size)
150
151 var pool = &sync.Pool{
152 New: func() any {
153 return make([]byte, size)
154 },
155 }
156 b.ResetTimer()
157
158 b.RunParallel(func(pb *testing.PB) {
159 for pb.Next() {
160 var buf = pool.Get().([]byte)
161 copy(buf, data)
162 pool.Put(buf)
163 }
164 })
165}
166
167func BenchmarkBytePool_Copy_Wrapper_16(b *testing.B) {
168 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