(b *testing.B)
| 43 | } |
| 44 | |
| 45 | func 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 | |
| 77 | func makeTestTenantIndex(numBlocks int) *TenantIndex { |
| 78 | const numDistinctDedicatedCols = 10 |
nothing calls this directly
no test coverage detected