MCPcopy Index your code
hub / github.com/deepflowio/deepflow / BenchmarkLockFreePoolGetPut1Thread

Function BenchmarkLockFreePoolGetPut1Thread

server/libs/pool/pool_test.go:86–103  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

84}
85
86func BenchmarkLockFreePoolGetPut1Thread(b *testing.B) {
87 pools := make([]*LockFreePool[int], b.N/1024)
88 for p, _ := range pools {
89 pool := NewLockFreePool(func() int { return 0 })
90 for i := 0; i < 1024; i++ {
91 pool.Put(0)
92 }
93 pools[p] = pool
94 }
95
96 b.ResetTimer()
97
98 for _, p := range pools {
99 for i := 0; i < 1024; i++ {
100 p.Get()
101 }
102 }
103}
104
105func BenchmarkLockFreePoolGetPut2Thread(b *testing.B) {
106 pools := make([]*LockFreePool[int], 16)

Callers

nothing calls this directly

Calls 3

NewLockFreePoolFunction · 0.85
PutMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected