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

Function BenchmarkState_GetInt8

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

Source from the content-addressed store, hash-verified

1050}
1051
1052func BenchmarkState_GetInt8(b *testing.B) {
1053 b.ReportAllocs()
1054 st := newState()
1055 n := 1000
1056 // Prepopulate the state with int8 values (using modulo to stay in range).
1057 for i := range n {
1058 key := "key" + strconv.Itoa(i)
1059 st.Set(key, int8(i%128))
1060 }
1061 i := 0
1062 for b.Loop() {
1063 i++
1064 key := "key" + strconv.Itoa(i%n)
1065 st.GetInt8(key)
1066 }
1067}
1068
1069func BenchmarkState_GetInt16(b *testing.B) {
1070 b.ReportAllocs()

Callers

nothing calls this directly

Calls 3

newStateFunction · 0.85
GetInt8Method · 0.80
SetMethod · 0.65

Tested by

no test coverage detected