You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/12/02 07:36:22 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #8761: ARROW-10697: [C++] Add notes about bitmap readers

pitrou commented on a change in pull request #8761:
URL: https://github.com/apache/arrow/pull/8761#discussion_r533951860



##########
File path: cpp/src/arrow/compute/kernels/vector_sort.cc
##########
@@ -238,21 +239,9 @@ inline void VisitRawValuesInline(const ArrayType& values,
                                  VisitorNotNull&& visitor_not_null,
                                  VisitorNull&& visitor_null) {
   const auto data = values.raw_values();
-  if (values.null_count() > 0) {
-    BitmapReader reader(values.null_bitmap_data(), values.offset(), values.length());
-    for (int64_t i = 0; i < values.length(); ++i) {
-      if (reader.IsSet()) {
-        visitor_not_null(data[i]);
-      } else {
-        visitor_null();
-      }
-      reader.Next();
-    }
-  } else {
-    for (int64_t i = 0; i < values.length(); ++i) {
-      visitor_not_null(data[i]);
-    }
-  }
+  VisitBitBlocksVoid(
+      values.null_bitmap(), values.offset(), values.length(),
+      [&](int64_t i) { visitor_not_null(data[i]); }, [&]() { visitor_null(); });

Review comment:
       A couple significant speedups, the rest is a wash:
   ```
   61         ArraySortIndicesInt64Narrow/32768/10000/min_time:1.000       1.502 GiB/sec       3.265 GiB/sec   117.397        {'run_name': 'ArraySortIndicesInt64Narrow/32768/10000/min_time:1.000', 'run_type': 'iteration', 'repetitions': 0, 'repetition_index': 0, 'threads': 1, 'iterations': 68135, 'null_percent': 0.01}
   19             ArraySortIndicesInt64Narrow/32768/0/min_time:1.000       1.754 GiB/sec       3.485 GiB/sec    98.636            {'run_name': 'ArraySortIndicesInt64Narrow/32768/0/min_time:1.000', 'run_type': 'iteration', 'repetitions': 0, 'repetition_index': 0, 'threads': 1, 'iterations': 108233, 'null_percent': 0.0}
   31           ArraySortIndicesInt64Narrow/32768/100/min_time:1.000       1.506 GiB/sec       2.432 GiB/sec    61.514           {'run_name': 'ArraySortIndicesInt64Narrow/32768/100/min_time:1.000', 'run_type': 'iteration', 'repetitions': 0, 'repetition_index': 0, 'threads': 1, 'iterations': 69677, 'null_percent': 1.0}
   71         ArraySortIndicesInt64Narrow/1048576/100/min_time:1.000       1.445 GiB/sec       2.058 GiB/sec    42.464          {'run_name': 'ArraySortIndicesInt64Narrow/1048576/100/min_time:1.000', 'run_type': 'iteration', 'repetitions': 0, 'repetition_index': 0, 'threads': 1, 'iterations': 2079, 'null_percent': 1.0}
   70         ArraySortIndicesInt64Narrow/8388608/100/min_time:1.000       1.176 GiB/sec       1.507 GiB/sec    28.098           {'run_name': 'ArraySortIndicesInt64Narrow/8388608/100/min_time:1.000', 'run_type': 'iteration', 'repetitions': 0, 'repetition_index': 0, 'threads': 1, 'iterations': 230, 'null_percent': 1.0}
   53     TableSortIndicesInt64Narrow/1048576/100/1/1/min_time:1.000  152.839m items/sec  194.723m items/sec    27.404                            {'run_name': 'TableSortIndicesInt64Narrow/1048576/100/1/1/min_time:1.000', 'run_type': 'iteration', 'repetitions': 0, 'repetition_index': 0, 'threads': 1, 'iterations': 188}
   45             ArraySortIndicesInt64Narrow/32768/2/min_time:1.000     872.577 MiB/sec       1.059 GiB/sec    24.262            {'run_name': 'ArraySortIndicesInt64Narrow/32768/2/min_time:1.000', 'run_type': 'iteration', 'repetitions': 0, 'repetition_index': 0, 'threads': 1, 'iterations': 37845, 'null_percent': 50.0}
   ```
   




----------------------------------------------------------------
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:
users@infra.apache.org