MCPcopy Create free account
hub / github.com/cantabular/faststringmap / BenchmarkUint32Store

Function BenchmarkUint32Store

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

Source from the content-addressed store, hash-verified

120const nStrsBench = 1000
121
122func BenchmarkUint32Store(b *testing.B) {
123 m := typicalCodeStrings(nStrsBench)
124 fm := faststringmap.NewUint32Store(m)
125 b.ResetTimer()
126 for bi := 0; bi < b.N; bi++ {
127 for si, n := uint32(0), uint32(len(m.in)); si < n; si++ {
128 v, ok := fm.LookupString(m.in[si])
129 if !ok || v != si {
130 b.Fatalf("ok=%v, value got %d want %d", ok, v, si)
131 }
132 }
133 }
134}
135
136func BenchmarkGoStringToUint32(b *testing.B) {
137 m := typicalCodeStrings(nStrsBench)

Callers

nothing calls this directly

Calls 3

LookupStringMethod · 0.95
NewUint32StoreFunction · 0.92
typicalCodeStringsFunction · 0.85

Tested by

no test coverage detected