(b *testing.B, metrics bool)
| 69 | func BenchmarkRistretto_Set_MetricsOn(b *testing.B) { benchRistrettoSet(b, true) } |
| 70 | |
| 71 | func benchRistrettoSet(b *testing.B, metrics bool) { |
| 72 | c := newBenchCache(b, metrics) |
| 73 | defer c.Close() |
| 74 | |
| 75 | // Value size approximates a cached DNS response payload. |
| 76 | val := make([]byte, 900) |
| 77 | |
| 78 | b.ReportAllocs() |
| 79 | b.ResetTimer() |
| 80 | |
| 81 | for i := 0; i < b.N; i++ { |
| 82 | // Use a changing key to avoid just updating one entry. |
| 83 | c.Set(uint64(i), val, int64(len(val))) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | func BenchmarkRistretto_GetHit_Parallel_MetricsOff(b *testing.B) { |
| 88 | benchRistrettoGetHitParallel(b, false) |
no test coverage detected
searching dependent graphs…