(b *testing.B)
| 153 | } |
| 154 | |
| 155 | func BenchmarkCounter_IncreaseKey2(b *testing.B) { |
| 156 | runtime.GOMAXPROCS(4) |
| 157 | |
| 158 | var counter = counters.NewCounter[uint32]() |
| 159 | |
| 160 | go func() { |
| 161 | var ticker = time.NewTicker(1 * time.Millisecond) |
| 162 | for range ticker.C { |
| 163 | counter.GC() |
| 164 | } |
| 165 | }() |
| 166 | |
| 167 | b.ResetTimer() |
| 168 | |
| 169 | var i uint64 |
| 170 | b.RunParallel(func(pb *testing.PB) { |
| 171 | for pb.Next() { |
| 172 | counter.IncreaseKey(types.String(atomic.AddUint64(&i, 1)%1e5), 20) |
| 173 | } |
| 174 | }) |
| 175 | |
| 176 | //b.Log(counter.TotalItems()) |
| 177 | } |
| 178 | |
| 179 | func BenchmarkCounter_GC(b *testing.B) { |
| 180 | runtime.GOMAXPROCS(4) |
nothing calls this directly
no test coverage detected