MCPcopy Create free account
hub / github.com/antchfx/xpath / BenchmarkLoadingCacheNoCap_SingleThread

Function BenchmarkLoadingCacheNoCap_SingleThread

cache_test.go:120–134  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

118}
119
120func BenchmarkLoadingCacheNoCap_SingleThread(b *testing.B) {
121 rand.Seed(benchLoadingCacheRandSeed)
122 c := NewLoadingCache(
123 func(key interface{}) (interface{}, error) {
124 return key, nil
125 }, 0) // 0 => no cap
126 for i := 0; i < b.N; i++ {
127 k := rand.Intn(benchLoadingCacheKeyRange)
128 v, _ := c.get(k)
129 if k != v {
130 b.FailNow()
131 }
132 }
133 b.Logf("N=%d, reset=%d", b.N, c.reset)
134}
135
136func BenchmarkLoadingCacheNoCap_MultiThread(b *testing.B) {
137 rand.Seed(benchLoadingCacheRandSeed)

Callers

nothing calls this directly

Calls 2

NewLoadingCacheFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…