(b *testing.B)
| 832 | } |
| 833 | |
| 834 | func 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 | |
| 853 | func BenchmarkState_GetBool(b *testing.B) { |
| 854 | b.ReportAllocs() |