(b *testing.B)
| 1131 | } |
| 1132 | |
| 1133 | func BenchmarkInt_UnmarshalMsg(b *testing.B) { |
| 1134 | sizes := []int{10, 100, 1000} |
| 1135 | |
| 1136 | for _, size := range sizes { |
| 1137 | b.Run(fmt.Sprintf("%d", size), func(b *testing.B) { |
| 1138 | set := make(Int) |
| 1139 | for i := 0; i < size; i++ { |
| 1140 | set[int(i)] = struct{}{} |
| 1141 | } |
| 1142 | |
| 1143 | data, _ := set.MarshalMsg(nil) |
| 1144 | |
| 1145 | b.ReportAllocs() |
| 1146 | b.ResetTimer() |
| 1147 | for i := 0; i < b.N; i++ { |
| 1148 | var decoded Int |
| 1149 | _, err := decoded.UnmarshalMsg(data) |
| 1150 | if err != nil { |
| 1151 | b.Fatal(err) |
| 1152 | } |
| 1153 | } |
| 1154 | }) |
| 1155 | } |
| 1156 | } |
| 1157 | |
| 1158 | func BenchmarkInt_AsSlice(b *testing.B) { |
| 1159 | sizes := []int{10, 100, 1000} |
nothing calls this directly
no test coverage detected
searching dependent graphs…