(b *testing.B)
| 85 | } |
| 86 | |
| 87 | func BenchmarkStat(b *testing.B) { |
| 88 | runtime.GOMAXPROCS(4) |
| 89 | |
| 90 | var stat = cachehits.NewStat(5) |
| 91 | for i := 0; i < 1_000_000; i++ { |
| 92 | stat.IncreaseCached("a" + types.String(i)) |
| 93 | } |
| 94 | |
| 95 | b.ResetTimer() |
| 96 | |
| 97 | b.RunParallel(func(pb *testing.PB) { |
| 98 | for pb.Next() { |
| 99 | var key = strconv.Itoa(rands.Int(0, 100_000)) |
| 100 | stat.IncreaseCached(key) |
| 101 | if rands.Int(0, 3) == 0 { |
| 102 | stat.IncreaseHit(key) |
| 103 | } |
| 104 | _ = stat.IsGood(key) |
| 105 | } |
| 106 | }) |
| 107 | } |
nothing calls this directly
no test coverage detected