pitrou commented on code in PR #40206:
URL: https://github.com/apache/arrow/pull/40206#discussion_r1504236409
##########
cpp/src/arrow/compute/kernels/vector_selection_benchmark.cc:
##########
@@ -158,6 +170,39 @@ struct TakeBenchmark {
}
state.SetItemsProcessed(state.iterations() * values->length());
}
+
+ void BenchChunked(const std::shared_ptr<ChunkedArray>& values, bool
chunk_indices_too) {
+ double indices_null_proportion = indices_have_nulls ? args.null_proportion
: 0;
+ auto indices =
+ rand.Int32(values->length(), 0, static_cast<int32_t>(values->length()
- 1),
+ indices_null_proportion);
+
+ if (monotonic_indices) {
+ auto arg_sorter = *SortIndices(*indices);
+ indices = *Take(*indices, *arg_sorter);
+ }
+ std::shared_ptr<ChunkedArray> chunked_indices;
+ if (chunk_indices_too) {
+ std::vector<std::shared_ptr<Array>> indices_chunks;
+ int64_t offset = 0;
+ for (int i = 0; i < values->num_chunks(); ++i) {
+ auto chunk = indices->Slice(offset, values->chunk(i)->length());
+ indices_chunks.push_back(std::move(chunk));
+ offset += values->chunk(i)->length();
+ }
+ chunked_indices =
std::make_shared<ChunkedArray>(std::move(indices_chunks));
+ }
+
+ if (chunk_indices_too) {
+ for (auto _ : state) {
+ ABORT_NOT_OK(Take(values, chunked_indices).status());
+ }
+ } else {
+ for (auto _ : state) {
+ ABORT_NOT_OK(Take(values, indices).status());
+ }
+ }
Review Comment:
Can we also call `SetItemsProcessed` 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]