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

Function BenchmarkBytePool_Get_Sync

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

Source from the content-addressed store, hash-verified

58}
59
60func BenchmarkBytePool_Get_Sync(b *testing.B) {
61 runtime.GOMAXPROCS(1)
62
63 var pool = &sync.Pool{
64 New: func() any {
65 return make([]byte, 1024)
66 },
67 }
68
69 b.ReportAllocs()
70 b.ResetTimer()
71
72 b.RunParallel(func(pb *testing.PB) {
73 for pb.Next() {
74 var buf = pool.Get()
75 pool.Put(buf)
76 }
77 })
78}
79
80func BenchmarkBytePool_Get_Sync2(b *testing.B) {
81 runtime.GOMAXPROCS(1)

Callers

nothing calls this directly

Calls 3

NextMethod · 0.80
GetMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected