(b *testing.B)
| 128 | } |
| 129 | |
| 130 | func BenchmarkCounter_IncreaseKey(b *testing.B) { |
| 131 | runtime.GOMAXPROCS(4) |
| 132 | |
| 133 | var counter = counters.NewCounter[uint32]() |
| 134 | |
| 135 | go func() { |
| 136 | var ticker = time.NewTicker(100 * time.Millisecond) |
| 137 | for range ticker.C { |
| 138 | counter.GC() |
| 139 | } |
| 140 | }() |
| 141 | |
| 142 | b.ResetTimer() |
| 143 | b.ReportAllocs() |
| 144 | |
| 145 | var i uint64 |
| 146 | b.RunParallel(func(pb *testing.PB) { |
| 147 | for pb.Next() { |
| 148 | counter.IncreaseKey(types.String(atomic.AddUint64(&i, 1)%1_000_000), 20) |
| 149 | } |
| 150 | }) |
| 151 | |
| 152 | //b.Log(counter.TotalItems()) |
| 153 | } |
| 154 | |
| 155 | func BenchmarkCounter_IncreaseKey2(b *testing.B) { |
| 156 | runtime.GOMAXPROCS(4) |
nothing calls this directly
no test coverage detected