| 423 | |
| 424 | template <typename T, typename EncodeFunc> |
| 425 | static void BM_ByteStreamSplitEncode(benchmark::State& state, EncodeFunc&& encode_func) { |
| 426 | const std::vector<T> values(state.range(0), ByteStreamSplitDummyValue<T>::value()); |
| 427 | const uint8_t* values_raw = reinterpret_cast<const uint8_t*>(values.data()); |
| 428 | std::vector<uint8_t> output(state.range(0) * sizeof(T)); |
| 429 | |
| 430 | for (auto _ : state) { |
| 431 | encode_func(values_raw, /*width=*/static_cast<int>(sizeof(T)), values.size(), |
| 432 | output.data()); |
| 433 | benchmark::ClobberMemory(); |
| 434 | } |
| 435 | state.SetBytesProcessed(state.iterations() * values.size() * sizeof(T)); |
| 436 | state.SetItemsProcessed(state.iterations() * values.size()); |
| 437 | } |
| 438 | |
| 439 | static void BM_ByteStreamSplitDecode_Float_Generic(benchmark::State& state) { |
| 440 | BM_ByteStreamSplitDecode<float>(state, ::arrow::util::internal::ByteStreamSplitDecode); |