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

Function BenchmarkBytePool_Copy_Wrapper_4

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

Source from the content-addressed store, hash-verified

121}
122
123func BenchmarkBytePool_Copy_Wrapper_4(b *testing.B) {
124 const size = 4 << 10
125
126 var data = bytes.Repeat([]byte{'A'}, size)
127
128 var pool = &sync.Pool{
129 New: func() any {
130 return &utils.BytesBuf{
131 Bytes: make([]byte, size),
132 }
133 },
134 }
135 b.ResetTimer()
136
137 b.RunParallel(func(pb *testing.PB) {
138 for pb.Next() {
139 var buf = pool.Get().(*utils.BytesBuf)
140 copy(buf.Bytes, data)
141 pool.Put(buf)
142 }
143 })
144}
145
146func BenchmarkBytePool_Copy_Bytes_16(b *testing.B) {
147 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