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

Function benchmarkColumnIterator

pkg/parquetquery/iters_test.go:246–268  ·  view source on GitHub ↗
(b *testing.B, makeIter makeTestIterFn)

Source from the content-addressed store, hash-verified

244}
245
246func benchmarkColumnIterator(b *testing.B, makeIter makeTestIterFn) {
247 count := 100_000
248 pf := createTestFile(b, count)
249
250 idx, _, _ := GetColumnIndexByPath(pf, "A")
251
252 b.ResetTimer()
253
254 for i := 0; i < b.N; i++ {
255 iter := makeIter(pf, idx, nil, "A")
256 actualCount := 0
257 for {
258 res, err := iter.Next()
259 require.NoError(b, err)
260 if res == nil {
261 break
262 }
263 actualCount++
264 }
265 iter.Close()
266 require.Equal(b, count, actualCount)
267 }
268}
269
270func createTestFile(t testing.TB, count int) *parquet.File {
271 type T struct{ A int }

Callers 1

BenchmarkColumnIteratorFunction · 0.85

Calls 5

createTestFileFunction · 0.85
GetColumnIndexByPathFunction · 0.85
NextMethod · 0.65
CloseMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected