| 95 | BENCHMARK(BM_PlainDecodingBoolean)->Range(MIN_RANGE, MAX_RANGE); |
| 96 | |
| 97 | static 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 | |
| 117 | BENCHMARK(BM_PlainDecodingBooleanToBitmap)->Range(MIN_RANGE, MAX_RANGE); |
| 118 |
nothing calls this directly
no test coverage detected