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

Function BenchmarkState_GetInt

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

Source from the content-addressed store, hash-verified

832}
833
834func BenchmarkState_GetInt(b *testing.B) {
835 b.ReportAllocs()
836
837 st := newState()
838 n := 1000
839 // prepopulate the state
840 for i := range n {
841 key := "key" + strconv.Itoa(i)
842 st.Set(key, i)
843 }
844
845 i := 0
846 for b.Loop() {
847 i++
848 key := "key" + strconv.Itoa(i%n)
849 st.GetInt(key)
850 }
851}
852
853func BenchmarkState_GetBool(b *testing.B) {
854 b.ReportAllocs()

Callers

nothing calls this directly

Calls 3

newStateFunction · 0.85
GetIntMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected