| 1414 | |
| 1415 | template <typename IndexType> |
| 1416 | void EncodeDictBenchmark(benchmark::State& state) { |
| 1417 | constexpr int64_t nunique = 100; |
| 1418 | constexpr int64_t min_length = 32; |
| 1419 | constexpr int64_t max_length = 32; |
| 1420 | ::arrow::random::RandomArrayGenerator rag(0); |
| 1421 | auto dict = rag.String(nunique, min_length, max_length, |
| 1422 | /*null_probability=*/0); |
| 1423 | auto indices = rag.Numeric<IndexType, int32_t>(num_values_, 0, nunique - 1); |
| 1424 | |
| 1425 | auto PutValues = [&](ByteArrayEncoder* encoder) { |
| 1426 | auto dict_encoder = dynamic_cast<DictEncoder<ByteArrayType>*>(encoder); |
| 1427 | dict_encoder->PutDictionary(*dict); |
| 1428 | dict_encoder->PutIndices(*indices); |
| 1429 | }; |
| 1430 | for (auto _ : state) { |
| 1431 | DoEncode(std::move(PutValues)); |
| 1432 | } |
| 1433 | state.SetItemsProcessed(state.iterations() * num_values_); |
| 1434 | } |
| 1435 | |
| 1436 | void DoEncodeArrow() override { |
| 1437 | auto PutValues = [&](ByteArrayEncoder* encoder) { |
nothing calls this directly
no test coverage detected