MCPcopy
hub / github.com/gofiber/fiber / BenchmarkState_Has

Function BenchmarkState_Has

state_test.go:967–982  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

965}
966
967func BenchmarkState_Has(b *testing.B) {
968 b.ReportAllocs()
969
970 st := newState()
971 n := 1000
972 // prepopulate the state
973 for i := range n {
974 st.Set("key"+strconv.Itoa(i), i)
975 }
976
977 i := 0
978 for b.Loop() {
979 i++
980 st.Has("key" + strconv.Itoa(i%n))
981 }
982}
983
984func BenchmarkState_Delete(b *testing.B) {
985 b.ReportAllocs()

Callers

nothing calls this directly

Calls 3

newStateFunction · 0.85
SetMethod · 0.65
HasMethod · 0.45

Tested by

no test coverage detected