(b *testing.B, shards int)
| 92 | func BenchmarkGet512(b *testing.B) { benchmarkGet(b, 512) } |
| 93 | |
| 94 | func benchmarkGet(b *testing.B, shards int) { |
| 95 | |
| 96 | hash := New(50, nil) |
| 97 | |
| 98 | var buckets []string |
| 99 | for i := 0; i < shards; i++ { |
| 100 | buckets = append(buckets, fmt.Sprintf("shard-%d", i)) |
| 101 | } |
| 102 | |
| 103 | hash.Add(buckets...) |
| 104 | |
| 105 | b.ResetTimer() |
| 106 | |
| 107 | for i := 0; i < b.N; i++ { |
| 108 | hash.Get(buckets[i&(shards-1)]) |
| 109 | } |
| 110 | } |
no test coverage detected
searching dependent graphs…