| 76 | |
| 77 | template <typename IndexType> |
| 78 | void Bench(bool sorted) { |
| 79 | if constexpr (sizeof(IndexType) < 8) { |
| 80 | constexpr uint64_t kLimitIndex = std::numeric_limits<IndexType>::max(); |
| 81 | ARROW_CHECK_LE(static_cast<uint64_t>(chunked_array_length), kLimitIndex); |
| 82 | } |
| 83 | const auto max_random_index = static_cast<IndexType>(chunked_array_length); |
| 84 | auto offsets = GenChunkedArrayOffsets(); |
| 85 | auto logical_indices = GenRandomIndices<IndexType>(max_random_index, sorted); |
| 86 | ChunkResolver resolver(std::move(offsets)); |
| 87 | std::vector<TypedChunkLocation<IndexType>> chunk_location_vec(num_logical_indices); |
| 88 | BENCHMARK_UNUSED bool all_succeeded = true; |
| 89 | for (auto _ : state) { |
| 90 | const bool success = resolver.ResolveMany<IndexType>( |
| 91 | num_logical_indices, logical_indices.data(), chunk_location_vec.data()); |
| 92 | all_succeeded &= success; |
| 93 | } |
| 94 | ARROW_CHECK(all_succeeded); |
| 95 | state.SetItemsProcessed(state.iterations() * num_logical_indices); |
| 96 | } |
| 97 | }; |
| 98 | |
| 99 | template <typename IndexType> |