MCPcopy Create free account
hub / github.com/cortexproject/cortex / BenchmarkMergeIterator

Function BenchmarkMergeIterator

pkg/querier/batch/merge_test.go:31–54  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

29}
30
31func BenchmarkMergeIterator(b *testing.B) {
32 chunks := make([]GenericChunk, 0, 10)
33 for i := range 10 {
34 chunks = append(chunks, mkGenericChunk(b, model.Time(i*25), 120, encoding.PrometheusXorChunk))
35 }
36 iter := newMergeIterator(nil, chunks)
37
38 for _, r := range []bool{true, false} {
39 b.Run(fmt.Sprintf("reuse-%t", r), func(b *testing.B) {
40 b.ReportAllocs()
41 for b.Loop() {
42 if r {
43 iter = newMergeIterator(iter, chunks)
44 } else {
45 iter = newMergeIterator(nil, chunks)
46 }
47 a := newIteratorAdapter(iter)
48 for a.Next() != chunkenc.ValNone {
49
50 }
51 }
52 })
53 }
54}
55
56func TestMergeHarder(t *testing.T) {
57 t.Parallel()

Callers

nothing calls this directly

Calls 6

mkGenericChunkFunction · 0.85
newMergeIteratorFunction · 0.85
newIteratorAdapterFunction · 0.85
LoopMethod · 0.80
RunMethod · 0.65
NextMethod · 0.65

Tested by

no test coverage detected