(b *testing.B)
| 70 | } |
| 71 | |
| 72 | func BenchmarkCompactorDupes(b *testing.B) { |
| 73 | rawR, rawW, _, err := local.New(&local.Config{ |
| 74 | Path: b.TempDir(), |
| 75 | }) |
| 76 | require.NoError(b, err) |
| 77 | |
| 78 | r := backend.NewReader(rawR) |
| 79 | w := backend.NewWriter(rawW) |
| 80 | ctx := context.Background() |
| 81 | l := log.NewNopLogger() |
| 82 | |
| 83 | cfg := &common.BlockConfig{ |
| 84 | BloomFP: 0.01, |
| 85 | BloomShardSizeBytes: 100 * 1024, |
| 86 | RowGroupSizeBytes: 20_000_000, |
| 87 | } |
| 88 | |
| 89 | // 1M span traces |
| 90 | meta := createTestBlock(b, ctx, cfg, r, w, 10, 1000, 1000, 1, nil) |
| 91 | inputs := []*backend.BlockMeta{meta, meta} |
| 92 | |
| 93 | b.ResetTimer() |
| 94 | |
| 95 | for i := 0; i < b.N; i++ { |
| 96 | c := NewCompactor(common.CompactionOptions{ |
| 97 | BlockConfig: *cfg, |
| 98 | OutputBlocks: 1, |
| 99 | MaxBytesPerTrace: 50_000_000, |
| 100 | ObjectsCombined: func(_, _ int) {}, |
| 101 | SpansDiscarded: func(_, _, _ string, _ int) {}, |
| 102 | }) |
| 103 | |
| 104 | _, err = c.Compact(ctx, l, r, w, inputs) |
| 105 | require.NoError(b, err) |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // createTestBlock with the number of given traces and the needed sizes. |
| 110 | // Trace IDs are guaranteed to be monotonically increasing so that |
nothing calls this directly
no test coverage detected