MCPcopy
hub / github.com/grafana/dskit / BenchmarkSearchToken

Function BenchmarkSearchToken

ring/util_test.go:483–501  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

481}
482
483func BenchmarkSearchToken(b *testing.B) {
484 r := rand.New(rand.NewSource(time.Now().UnixNano()))
485 gen := initTokenGenerator(b)
486
487 tokensPerInstance := 512
488 numInstances := []int{3, 9, 27, 81, 243, 729}
489
490 for _, instances := range numInstances {
491 b.Run(fmt.Sprintf("searchToken_%d_instances", instances), func(b *testing.B) {
492 for i := 0; i < b.N; i++ {
493 b.StopTimer()
494 tokens := gen.GenerateTokens(instances*tokensPerInstance, []uint32{})
495 hash := r.Uint32()
496 b.StartTimer()
497 searchToken(tokens, hash)
498 }
499 })
500 }
501}
502
503func TestStringSet(t *testing.T) {
504 t.Parallel()

Callers

nothing calls this directly

Calls 4

initTokenGeneratorFunction · 0.85
searchTokenFunction · 0.85
RunMethod · 0.80
GenerateTokensMethod · 0.65

Tested by

no test coverage detected