(b *testing.B)
| 1268 | } |
| 1269 | |
| 1270 | func BenchmarkIntSorted_UnmarshalMsg(b *testing.B) { |
| 1271 | sizes := []int{10, 100, 1000} |
| 1272 | |
| 1273 | for _, size := range sizes { |
| 1274 | b.Run(fmt.Sprintf("%d", size), func(b *testing.B) { |
| 1275 | set := make(IntSorted) |
| 1276 | for i := 0; i < size; i++ { |
| 1277 | set[int(i)] = struct{}{} |
| 1278 | } |
| 1279 | |
| 1280 | data, _ := set.MarshalMsg(nil) |
| 1281 | |
| 1282 | b.ReportAllocs() |
| 1283 | b.ResetTimer() |
| 1284 | for i := 0; i < b.N; i++ { |
| 1285 | var decoded IntSorted |
| 1286 | _, err := decoded.UnmarshalMsg(data) |
| 1287 | if err != nil { |
| 1288 | b.Fatal(err) |
| 1289 | } |
| 1290 | } |
| 1291 | }) |
| 1292 | } |
| 1293 | } |
| 1294 | |
| 1295 | func BenchmarkIntSorted_AsSlice(b *testing.B) { |
| 1296 | sizes := []int{10, 100, 1000} |
nothing calls this directly
no test coverage detected
searching dependent graphs…