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

Function BenchmarkState_GetFloat64

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

Source from the content-addressed store, hash-verified

870}
871
872func BenchmarkState_GetFloat64(b *testing.B) {
873 b.ReportAllocs()
874
875 st := newState()
876 n := 1000
877 // prepopulate the state
878 for i := range n {
879 key := "key" + strconv.Itoa(i)
880 st.Set(key, float64(i))
881 }
882
883 i := 0
884 for b.Loop() {
885 i++
886 key := "key" + strconv.Itoa(i%n)
887 st.GetFloat64(key)
888 }
889}
890
891func BenchmarkState_MustGet(b *testing.B) {
892 b.ReportAllocs()

Callers

nothing calls this directly

Calls 3

newStateFunction · 0.85
GetFloat64Method · 0.80
SetMethod · 0.65

Tested by

no test coverage detected