| 1059 | |
| 1060 | template <typename Type> |
| 1061 | static void EncodeDict(const std::vector<typename Type::c_type>& values, |
| 1062 | benchmark::State& state) { |
| 1063 | using T = typename Type::c_type; |
| 1064 | int num_values = static_cast<int>(values.size()); |
| 1065 | |
| 1066 | MemoryPool* allocator = default_memory_pool(); |
| 1067 | std::shared_ptr<ColumnDescriptor> descr = Int64Schema(Repetition::REQUIRED); |
| 1068 | |
| 1069 | auto base_encoder = MakeEncoder(Type::type_num, Encoding::RLE_DICTIONARY, |
| 1070 | /*use_dictionary=*/true, descr.get(), allocator); |
| 1071 | auto encoder = |
| 1072 | dynamic_cast<typename EncodingTraits<Type>::Encoder*>(base_encoder.get()); |
| 1073 | for (auto _ : state) { |
| 1074 | encoder->Put(values.data(), num_values); |
| 1075 | encoder->FlushValues(); |
| 1076 | } |
| 1077 | |
| 1078 | state.SetBytesProcessed(state.iterations() * num_values * sizeof(T)); |
| 1079 | state.SetItemsProcessed(state.iterations() * num_values); |
| 1080 | } |
| 1081 | |
| 1082 | template <typename Type> |
| 1083 | static void DecodeDict(const std::vector<typename Type::c_type>& values, |
nothing calls this directly
no test coverage detected