MCPcopy Create free account
hub / github.com/cockroachdb/swiss / benchmarkRuntimeMapIter

Function benchmarkRuntimeMapIter

bench_test.go:169–185  ·  view source on GitHub ↗
(b *testing.B, n int, genKeys func(start, end int) []T)

Source from the content-addressed store, hash-verified

167}
168
169func benchmarkRuntimeMapIter[T benchTypes](b *testing.B, n int, genKeys func(start, end int) []T) {
170 c := perfbench.Open(b)
171
172 m := make(map[T]T, n)
173 keys := genKeys(0, n)
174 for _, k := range keys {
175 m[k] = k
176 }
177 b.ResetTimer()
178 c.Reset()
179 var tmp T
180 for i := 0; i < b.N; i++ {
181 for k, v := range m {
182 tmp += k + v
183 }
184 }
185}
186
187func benchmarkSwissMapIter[T benchTypes](b *testing.B, n int, genKeys func(start, end int) []T) {
188 c := perfbench.Open(b)

Callers

nothing calls this directly

Calls 1

genKeysFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…