(b *testing.B)
| 1050 | } |
| 1051 | |
| 1052 | func 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 | |
| 1069 | func BenchmarkState_GetInt16(b *testing.B) { |
| 1070 | b.ReportAllocs() |