(b *testing.B)
| 103 | } |
| 104 | |
| 105 | func BenchmarkLockFreePoolGetPut2Thread(b *testing.B) { |
| 106 | pools := make([]*LockFreePool[int], 16) |
| 107 | for i := range pools { |
| 108 | pool := NewLockFreePool(func() int { return 0 }) |
| 109 | pools[i] = pool |
| 110 | } |
| 111 | |
| 112 | put := func(pool []*LockFreePool[int]) { |
| 113 | for i := 0; i < b.N; i++ { |
| 114 | for _, p := range pools { |
| 115 | p.Put(0) |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | b.ResetTimer() |
| 121 | go put(pools) |
| 122 | for i := 0; i < b.N; i++ { |
| 123 | for _, p := range pools { |
| 124 | p.Get() |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | func BenchmarkLockFreePoolHungryGet(b *testing.B) { |
| 130 | pool := NewLockFreePool[int](func() int { return 0 }) |
nothing calls this directly
no test coverage detected