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

Function BenchmarkNativePoolGetPut1Thread

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

Source from the content-addressed store, hash-verified

23)
24
25func BenchmarkNativePoolGetPut1Thread(b *testing.B) {
26 pools := make([]*sync.Pool, b.N/1024)
27 for p, _ := range pools {
28 pool := sync.Pool{New: func() interface{} { return 0 }}
29 for i := 0; i < 1024; i++ {
30 pool.Put(0)
31 }
32 pools[p] = &pool
33 }
34
35 b.ResetTimer()
36
37 for _, p := range pools {
38 for i := 0; i < 1024; i++ {
39 p.Get()
40 }
41 }
42}
43
44func BenchmarkNativePoolGetPut2Thread(b *testing.B) {
45 pools := make([]*sync.Pool, 16)

Callers

nothing calls this directly

Calls 2

PutMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected