(b *testing.B)
| 813 | } |
| 814 | |
| 815 | func BenchmarkState_GetString(b *testing.B) { |
| 816 | b.ReportAllocs() |
| 817 | |
| 818 | st := newState() |
| 819 | n := 1000 |
| 820 | // prepopulate the state |
| 821 | for i := range n { |
| 822 | key := "key" + strconv.Itoa(i) |
| 823 | st.Set(key, strconv.Itoa(i)) |
| 824 | } |
| 825 | |
| 826 | i := 0 |
| 827 | for b.Loop() { |
| 828 | i++ |
| 829 | key := "key" + strconv.Itoa(i%n) |
| 830 | st.GetString(key) |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | func BenchmarkState_GetInt(b *testing.B) { |
| 835 | b.ReportAllocs() |