cyb70289 commented on a change in pull request #10009:
URL: https://github.com/apache/arrow/pull/10009#discussion_r613725348



##########
File path: cpp/src/arrow/compute/kernels/vector_sort.cc
##########
@@ -492,16 +493,8 @@ class ArrayCountOrCompareSorter {
   uint64_t* Sort(uint64_t* indices_begin, uint64_t* indices_end, const 
ArrayType& values,
                  int64_t offset, const ArraySortOptions& options) {
     if (values.length() >= countsort_min_len_ && values.length() > 
values.null_count()) {
-      c_type min{std::numeric_limits<c_type>::max()};
-      c_type max{std::numeric_limits<c_type>::min()};
-
-      VisitRawValuesInline(
-          values,
-          [&](c_type v) {
-            min = std::min(min, v);
-            max = std::max(max, v);
-          },
-          []() {});
+      c_type min, max;
+      std::tie(min, max) = GetMinMax<c_type>(*values.data());

Review comment:
       A bit performance improvement for int64narrow sorting.
   ```
                              benchmark            baseline           contender 
 change %
    ArraySortIndicesInt64Narrow/32768/2     507.257 MiB/sec     632.995 MiB/sec 
   24.788
   ArraySortIndicesInt64Narrow/32768/10     643.182 MiB/sec     724.483 MiB/sec 
   12.640
   ```




-- 
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.

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


Reply via email to