You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2021/04/19 08:22:55 UTC

[arrow] branch master updated: ARROW-12395: Create RunInSerialExecutor benchmark

This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 2d791b4  ARROW-12395: Create RunInSerialExecutor benchmark
2d791b4 is described below

commit 2d791b4e427366506e5ce2c288a74d0ed21d900d
Author: Weston Pace <we...@gmail.com>
AuthorDate: Mon Apr 19 10:21:30 2021 +0200

    ARROW-12395: Create RunInSerialExecutor benchmark
    
    Closes #10042 from westonpace/feature/arrow-12395
    
    Authored-by: Weston Pace <we...@gmail.com>
    Signed-off-by: Antoine Pitrou <an...@python.org>
---
 cpp/src/arrow/util/thread_pool_benchmark.cc | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/cpp/src/arrow/util/thread_pool_benchmark.cc b/cpp/src/arrow/util/thread_pool_benchmark.cc
index 2ff4d11..054d616 100644
--- a/cpp/src/arrow/util/thread_pool_benchmark.cc
+++ b/cpp/src/arrow/util/thread_pool_benchmark.cc
@@ -103,6 +103,22 @@ static void ThreadPoolSpawn(benchmark::State& state) {  // NOLINT non-const refe
   state.SetItemsProcessed(state.iterations() * nspawns);
 }
 
+// Benchmark SerialExecutor::RunInSerialExecutor
+static void RunInSerialExecutor(benchmark::State& state) {  // NOLINT non-const reference
+  const auto workload_size = static_cast<int32_t>(state.range(0));
+
+  Workload workload(workload_size);
+
+  for (auto _ : state) {
+    SerialExecutor::RunInSerialExecutor<arrow::detail::Empty>(
+        [&](internal::Executor* executor) {
+          return DeferNotOk(executor->Submit(std::ref(workload)));
+        });
+  }
+
+  state.SetItemsProcessed(state.iterations());
+}
+
 // Benchmark ThreadPool::Submit
 static void ThreadPoolSubmit(benchmark::State& state) {  // NOLINT non-const reference
   const auto nthreads = static_cast<int>(state.range(0));
@@ -223,6 +239,7 @@ BENCHMARK(ReferenceWorkloadCost)->Apply(WorkloadCost_Customize);
 #endif
 
 BENCHMARK(SerialTaskGroup)->Apply(WorkloadCost_Customize);
+BENCHMARK(RunInSerialExecutor)->Apply(WorkloadCost_Customize);
 BENCHMARK(ThreadPoolSpawn)->Apply(ThreadPoolSpawn_Customize);
 BENCHMARK(ThreadedTaskGroup)->Apply(ThreadPoolSpawn_Customize);
 BENCHMARK(ThreadPoolSubmit)->Apply(ThreadPoolSpawn_Customize);