felipecrv commented on code in PR #34811:
URL: https://github.com/apache/arrow/pull/34811#discussion_r1154854792
##########
cpp/src/arrow/compute/kernels/vector_sort_benchmark.cc:
##########
@@ -99,6 +99,40 @@ static void
ChunkedArraySortFuncInt64Benchmark(benchmark::State& state,
ArraySortFuncBenchmark(state, runner,
std::make_shared<ChunkedArray>(chunks));
}
+template <typename Runner>
+static void ChunkedArraySortFuncStringBenchmark(benchmark::State& state,
+ const Runner& runner, int32_t
min_length,
+ int32_t max_length) {
+ RegressionArgs args(state);
+
+ // The array_size is derived from these two equations:
+ //
+ // size = array_size * (1.0 - args.null_proportion) * string_mean_length
+ // string_mean_length = (max_length + min_length) / 2.0
+ const double valid_proportion = 1.0 - args.null_proportion;
+ const double array_size =
+ (valid_proportion > std::numeric_limits<double>::epsilon())
+ ? (args.size * 2) / (valid_proportion * (max_length + min_length))
+ : (args.size * 2) / (max_length + min_length);
+
+ const auto n_chunks = 10;
+ const auto array_chunk_size = static_cast<int64_t>(std::round(array_size /
n_chunks));
+ auto rand = random::RandomArrayGenerator(kSeed);
+
+ ArrayVector chunks;
+ int64_t generated_array_size_in_bytes = 0;
+ for (auto i = 0; i < n_chunks; ++i) {
+ auto values =
+ rand.String(array_chunk_size, min_length, max_length,
args.null_proportion);
Review Comment:
I pasted below. Null in variable-size binary arrays will reduce the amout of
data in the data buffer, making CPU caching more effective.
--
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]