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

Function BM_PlainDecodingBooleanToBitmap

cpp/src/parquet/encoding_benchmark.cc:97–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95BENCHMARK(BM_PlainDecodingBoolean)->Range(MIN_RANGE, MAX_RANGE);
96
97static void BM_PlainDecodingBooleanToBitmap(benchmark::State& state) {
98 std::vector<bool> values(state.range(0), true);
99 int64_t bitmap_bytes = ::arrow::bit_util::BytesForBits(state.range(0));
100 std::vector<uint8_t> output(bitmap_bytes, 0);
101 auto encoder = MakeEncoder(Type::BOOLEAN, Encoding::PLAIN);
102 auto typed_encoder = dynamic_cast<BooleanEncoder*>(encoder.get());
103 typed_encoder->Put(values, static_cast<int>(values.size()));
104 std::shared_ptr<Buffer> buf = encoder->FlushValues();
105
106 for (auto _ : state) {
107 auto decoder = MakeTypedDecoder<BooleanType>(Encoding::PLAIN);
108 decoder->SetData(static_cast<int>(values.size()), buf->data(),
109 static_cast<int>(buf->size()));
110 decoder->Decode(output.data(), static_cast<int>(values.size()));
111 }
112 // Still set `BytesProcessed` to byte level.
113 state.SetBytesProcessed(state.iterations() * bitmap_bytes);
114 state.SetItemsProcessed(state.iterations() * state.range(0));
115}
116
117BENCHMARK(BM_PlainDecodingBooleanToBitmap)->Range(MIN_RANGE, MAX_RANGE);
118

Callers

nothing calls this directly

Calls 9

BytesForBitsFunction · 0.85
MakeEncoderFunction · 0.70
getMethod · 0.45
PutMethod · 0.45
sizeMethod · 0.45
FlushValuesMethod · 0.45
SetDataMethod · 0.45
dataMethod · 0.45
DecodeMethod · 0.45

Tested by

no test coverage detected