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

Function benchmarkRuntimeMapPutDelete

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

Source from the content-addressed store, hash-verified

397}
398
399func benchmarkRuntimeMapPutDelete[T benchTypes](
400 b *testing.B, n int, genKeys func(start, end int) []T,
401) {
402 c := perfbench.Open(b)
403
404 m := make(map[T]T, n)
405 keys := genKeys(0, n)
406 for _, k := range keys {
407 m[k] = k
408 }
409 b.ResetTimer()
410 c.Reset()
411 for i := 0; i < b.N; i++ {
412 j := i % n
413 delete(m, keys[j])
414 m[keys[j]] = keys[j]
415 }
416}
417
418func benchmarkSwissMapPutDelete[T benchTypes](
419 b *testing.B, n int, genKeys func(start, end int) []T,

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…