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

Function BenchmarkIndexMarshal

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

Source from the content-addressed store, hash-verified

17)
18
19func BenchmarkIndexMarshal(b *testing.B) {
20 b.Run("format=json", func(b *testing.B) {
21 for _, numBlocks := range []int{100, 1000, 10000} {
22 b.Run(fmt.Sprintf("blocks=%d", numBlocks), func(b *testing.B) {
23 dedicatedColumnsCache.Purge()
24 idx := makeTestTenantIndex(numBlocks)
25 for b.Loop() {
26 doNotOptimizeBytes, _ = idx.marshal()
27 }
28 })
29 }
30 })
31
32 b.Run("format=proto", func(b *testing.B) {
33 for _, numBlocks := range []int{100, 1000, 10000} {
34 b.Run(fmt.Sprintf("blocks=%d", numBlocks), func(b *testing.B) {
35 dedicatedColumnsCache.Purge()
36 idx := makeTestTenantIndex(numBlocks)
37 for b.Loop() {
38 doNotOptimizeBytes, _ = idx.marshalPb()
39 }
40 })
41 }
42 })
43}
44
45func BenchmarkIndexUnmarshal(b *testing.B) {
46 b.Run("format=json", func(b *testing.B) {

Callers

nothing calls this directly

Calls 5

makeTestTenantIndexFunction · 0.85
LoopMethod · 0.80
marshalMethod · 0.80
marshalPbMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected