(b *testing.B)
| 889 | } |
| 890 | |
| 891 | func BenchmarkState_MustGet(b *testing.B) { |
| 892 | b.ReportAllocs() |
| 893 | |
| 894 | st := newState() |
| 895 | n := 1000 |
| 896 | // prepopulate the state |
| 897 | for i := range n { |
| 898 | key := "key" + strconv.Itoa(i) |
| 899 | st.Set(key, i) |
| 900 | } |
| 901 | |
| 902 | i := 0 |
| 903 | for b.Loop() { |
| 904 | i++ |
| 905 | key := "key" + strconv.Itoa(i%n) |
| 906 | st.MustGet(key) |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | func BenchmarkState_GetStateGeneric(b *testing.B) { |
| 911 | b.ReportAllocs() |