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

Function BenchmarkBytePool_Get_Sync2

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

Source from the content-addressed store, hash-verified

78}
79
80func BenchmarkBytePool_Get_Sync2(b *testing.B) {
81 runtime.GOMAXPROCS(1)
82
83 var pool = &sync.Pool{
84 New: func() any {
85 return &utils.BytesBuf{
86 Bytes: make([]byte, 1024),
87 }
88 },
89 }
90
91 b.ReportAllocs()
92 b.ResetTimer()
93
94 b.RunParallel(func(pb *testing.PB) {
95 for pb.Next() {
96 var buf = pool.Get()
97 pool.Put(buf)
98 }
99 })
100}
101
102func BenchmarkBytePool_Copy_Bytes_4(b *testing.B) {
103 const size = 4 << 10

Callers

nothing calls this directly

Calls 3

NextMethod · 0.80
GetMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected