(b *testing.B)
| 965 | } |
| 966 | |
| 967 | func BenchmarkState_Has(b *testing.B) { |
| 968 | b.ReportAllocs() |
| 969 | |
| 970 | st := newState() |
| 971 | n := 1000 |
| 972 | // prepopulate the state |
| 973 | for i := range n { |
| 974 | st.Set("key"+strconv.Itoa(i), i) |
| 975 | } |
| 976 | |
| 977 | i := 0 |
| 978 | for b.Loop() { |
| 979 | i++ |
| 980 | st.Has("key" + strconv.Itoa(i%n)) |
| 981 | } |
| 982 | } |
| 983 | |
| 984 | func BenchmarkState_Delete(b *testing.B) { |
| 985 | b.ReportAllocs() |