============================================================================ 第六部分:Benchmark — 性能基准 ============================================================================ --- label ---
(b *testing.B)
| 929 | // --- label --- |
| 930 | |
| 931 | func BenchmarkLabel_Add(b *testing.B) { |
| 932 | for _, size := range []int{1000, 10_000, 100_000} { |
| 933 | batch := generateProtoLabels(size) |
| 934 | b.Run(fmt.Sprintf("n=%d", size), func(b *testing.B) { |
| 935 | for i := 0; i < b.N; i++ { |
| 936 | l := newTestLabel() |
| 937 | populateLabelDeps(l, size) |
| 938 | l.Add(batch) |
| 939 | } |
| 940 | }) |
| 941 | } |
| 942 | } |
| 943 | |
| 944 | func BenchmarkLabel_GetIDByKey(b *testing.B) { |
| 945 | for _, size := range benchmarkLabelLookupSizes() { |
nothing calls this directly
no test coverage detected