pitrou commented on code in PR #36298:
URL: https://github.com/apache/arrow/pull/36298#discussion_r1244041526


##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -782,6 +782,27 @@ static void BM_RleDecodingSpacedBoolean(benchmark::State& 
state) {
 }
 BENCHMARK(BM_RleDecodingSpacedBoolean)->Apply(BM_SpacedArgs);
 
+template <typename Type>
+static void EncodeDict(std::vector<typename Type::c_type>& values,
+                       benchmark::State& state) {
+  using T = typename Type::c_type;
+  int num_values = static_cast<int>(values.size());
+
+  MemoryPool* allocator = default_memory_pool();
+  std::shared_ptr<ColumnDescriptor> descr = Int64Schema(Repetition::REQUIRED);
+
+  auto base_encoder = MakeEncoder(Type::type_num, Encoding::RLE_DICTIONARY,
+                                  /*use_dictionary=*/true, descr.get(), 
allocator);
+  auto encoder =
+      dynamic_cast<typename 
EncodingTraits<Type>::Encoder*>(base_encoder.get());
+  for (auto _ : state) {
+    encoder->Put(values.data(), num_values);
+    encoder->FlushValues();
+  }
+
+  state.SetBytesProcessed(state.iterations() * state.range(0) * sizeof(T));

Review Comment:
   You addressed only one comment here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to