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

Function BenchmarkIndexUnmarshal

tempodb/backend/tenantindex_benchmark_test.go:45–75  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

43}
44
45func BenchmarkIndexUnmarshal(b *testing.B) {
46 b.Run("format=json", func(b *testing.B) {
47 for _, numBlocks := range []int{100, 1000, 10000} {
48 b.Run(fmt.Sprintf("blocks=%d", numBlocks), func(b *testing.B) {
49 dedicatedColumnsCache.Purge()
50 idx := makeTestTenantIndex(numBlocks)
51 idxBuf, err := idx.marshal()
52 require.NoError(b, err)
53 for b.Loop() {
54 doNotOptimizeTenantIndex = &TenantIndex{}
55 _ = doNotOptimizeTenantIndex.unmarshal(idxBuf)
56 }
57 })
58 }
59 })
60
61 b.Run("format=proto", func(b *testing.B) {
62 for _, numBlocks := range []int{100, 1000, 10000} {
63 b.Run(fmt.Sprintf("blocks=%d", numBlocks), func(b *testing.B) {
64 dedicatedColumnsCache.Purge()
65 idx := makeTestTenantIndex(numBlocks)
66 idxBuf, err := idx.marshal()
67 require.NoError(b, err)
68 for b.Loop() {
69 doNotOptimizeTenantIndex = &TenantIndex{}
70 _ = doNotOptimizeTenantIndex.unmarshalPb(idxBuf)
71 }
72 })
73 }
74 })
75}
76
77func makeTestTenantIndex(numBlocks int) *TenantIndex {
78 const numDistinctDedicatedCols = 10

Callers

nothing calls this directly

Calls 6

makeTestTenantIndexFunction · 0.85
marshalMethod · 0.80
LoopMethod · 0.80
unmarshalMethod · 0.80
unmarshalPbMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected