MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / BenchmarkCounter_IncreaseKey2

Function BenchmarkCounter_IncreaseKey2

internal/utils/counters/counter_test.go:155–177  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

153}
154
155func 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
179func BenchmarkCounter_GC(b *testing.B) {
180 runtime.GOMAXPROCS(4)

Callers

nothing calls this directly

Calls 4

NextMethod · 0.80
IncreaseKeyMethod · 0.80
GCMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected