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

Function BM_ReadColumnIndex

cpp/src/parquet/page_index_benchmark.cc:66–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65template <typename DType>
66void BM_ReadColumnIndex(::benchmark::State& state) {
67 schema::NodePtr type = ::parquet::schema::PrimitiveNode::Make(
68 "b", Repetition::OPTIONAL, DType::type_num, ConvertedType::NONE, 8);
69 auto descr_ptr =
70 std::make_unique<ColumnDescriptor>(type, /*def_level=*/1, /*rep_level=*/0);
71 auto descr = descr_ptr.get();
72
73 const int num_pages = static_cast<int>(state.range(0));
74 auto builder = ColumnIndexBuilder::Make(descr);
75
76 const size_t values_per_page = 100;
77 for (int i = 0; i < num_pages; ++i) {
78 auto stats = MakeStatistics<DType>(descr);
79 std::vector<uint8_t> heap;
80 std::vector<typename DType::c_type> values;
81 values.resize(values_per_page);
82 GenerateBenchmarkData(values_per_page, /*seed=*/0, values.data(), &heap,
83 kDataStringLength);
84 stats->Update(values.data(), values_per_page, /*null_count=*/0);
85 builder->AddPage(stats->Encode(), /*size_stats=*/{});
86 }
87
88 builder->Finish();
89 auto sink = CreateOutputStream();
90 builder->WriteTo(sink.get());
91 auto buffer = sink->Finish().ValueOrDie();
92 ReaderProperties properties;
93 for (auto _ : state) {
94 auto column_index = ColumnIndex::Make(*descr, buffer->data() + 0,
95 static_cast<int>(buffer->size()), properties);
96 ::benchmark::DoNotOptimize(column_index);
97 }
98 state.SetBytesProcessed(state.iterations() * buffer->size());
99 state.SetItemsProcessed(state.iterations() * num_pages);
100}
101
102BENCHMARK_TEMPLATE(BM_ReadColumnIndex, Int64Type)->Apply(PageIndexSetArgs);
103BENCHMARK_TEMPLATE(BM_ReadColumnIndex, DoubleType)->Apply(PageIndexSetArgs);

Callers

nothing calls this directly

Calls 13

GenerateBenchmarkDataFunction · 0.85
CreateOutputStreamFunction · 0.85
resizeMethod · 0.80
ValueOrDieMethod · 0.80
MakeFunction · 0.70
getMethod · 0.45
dataMethod · 0.45
UpdateMethod · 0.45
AddPageMethod · 0.45
EncodeMethod · 0.45
FinishMethod · 0.45
WriteToMethod · 0.45

Tested by

no test coverage detected