MCPcopy
hub / github.com/grafana/tempo / benchmarkCompactor

Function benchmarkCompactor

tempodb/encoding/vparquet3/compactor_test.go:37–70  ·  view source on GitHub ↗
(b *testing.B, traceCount, batchCount, spanCount int)

Source from the content-addressed store, hash-verified

35}
36
37func benchmarkCompactor(b *testing.B, traceCount, batchCount, spanCount int) {
38 rawR, rawW, _, err := local.New(&local.Config{
39 Path: b.TempDir(),
40 })
41 require.NoError(b, err)
42
43 r := backend.NewReader(rawR)
44 w := backend.NewWriter(rawW)
45 ctx := context.Background()
46 l := log.NewNopLogger()
47
48 cfg := &common.BlockConfig{
49 BloomFP: 0.01,
50 BloomShardSizeBytes: 100 * 1024,
51 RowGroupSizeBytes: 20_000_000,
52 }
53
54 meta := createTestBlock(b, ctx, cfg, r, w, traceCount, batchCount, spanCount, 0, nil)
55
56 inputs := []*backend.BlockMeta{meta}
57
58 b.ResetTimer()
59
60 for i := 0; i < b.N; i++ {
61 c := NewCompactor(common.CompactionOptions{
62 BlockConfig: *cfg,
63 OutputBlocks: 1,
64 MaxBytesPerTrace: 50_000_000,
65 })
66
67 _, err = c.Compact(ctx, l, r, w, inputs)
68 require.NoError(b, err)
69 }
70}
71
72func BenchmarkCompactorDupes(b *testing.B) {
73 rawR, rawW, _, err := local.New(&local.Config{

Callers 1

BenchmarkCompactorFunction · 0.70

Calls 6

CompactMethod · 0.95
NewFunction · 0.92
NewReaderFunction · 0.92
NewWriterFunction · 0.92
createTestBlockFunction · 0.70
NewCompactorFunction · 0.70

Tested by

no test coverage detected