MCPcopy Create free account
hub / github.com/apache/arrow / ColumnReaderReadBatchInt32

Function ColumnReaderReadBatchInt32

cpp/src/parquet/column_reader_benchmark.cc:122–146  ·  view source on GitHub ↗

Benchmarks ReadBatch for ColumnReader with the following parameters in order: - repetition: 0 for REQUIRED, 1 for OPTIONAL, 2 for REPEATED. - batch_size: sets how many values to read at each call.

Source from the content-addressed store, hash-verified

120// - repetition: 0 for REQUIRED, 1 for OPTIONAL, 2 for REPEATED.
121// - batch_size: sets how many values to read at each call.
122static void ColumnReaderReadBatchInt32(::benchmark::State& state) {
123 const auto repetition = static_cast<Repetition::type>(state.range(0));
124 const auto batch_size = static_cast<int64_t>(state.range(1));
125
126 BenchmarkHelper helper(repetition, /*num_pages=*/16, /*levels_per_page=*/80000);
127
128 // Vectors to read the values into.
129 std::vector<int32_t> read_values(batch_size, -1);
130 std::vector<int16_t> read_defs(batch_size, -1);
131 std::vector<int16_t> read_reps(batch_size, -1);
132 for (auto _ : state) {
133 state.PauseTiming();
134 Int32Reader* reader = helper.ResetColumnReader();
135 int64_t values_count = -1;
136 state.ResumeTiming();
137 while (values_count != 0) {
138 int64_t values_read = 0;
139 DoNotOptimize(values_count =
140 reader->ReadBatch(batch_size, read_defs.data(), read_reps.data(),
141 read_values.data(), &values_read));
142 }
143 }
144
145 state.SetBytesProcessed(state.iterations() * helper.total_size());
146}
147
148// Benchmarks ReadRecords for RecordReader with the following parameters in order:
149// - repetition: 0 for REQUIRED, 1 for OPTIONAL, 2 for REPEATED.

Callers

nothing calls this directly

Calls 4

ResetColumnReaderMethod · 0.80
total_sizeMethod · 0.80
ReadBatchMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected