MCPcopy Create free account
hub / github.com/apache/arrow / SerialTaskGroup

Function SerialTaskGroup

cpp/src/arrow/util/thread_pool_benchmark.cc:155–171  ·  view source on GitHub ↗

Benchmark serial TaskGroup

Source from the content-addressed store, hash-verified

153
154// Benchmark serial TaskGroup
155static void SerialTaskGroup(benchmark::State& state) { // NOLINT non-const reference
156 const auto workload_size = static_cast<int32_t>(state.range(0));
157
158 Task task(workload_size);
159
160 const int32_t nspawns = 10000000 / workload_size + 1;
161
162 for (auto _ : state) {
163 auto task_group = TaskGroup::MakeSerial();
164 for (int32_t i = 0; i < nspawns; ++i) {
165 // Pass the task by reference to avoid copying it around
166 task_group->Append(std::ref(task));
167 }
168 ABORT_NOT_OK(task_group->Finish());
169 }
170 state.SetItemsProcessed(state.iterations() * nspawns);
171}
172
173// Benchmark threaded TaskGroup
174static void ThreadedTaskGroup(benchmark::State& state) { // NOLINT non-const reference

Callers

nothing calls this directly

Calls 3

refFunction · 0.85
AppendMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected