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 2021/12/08 11:06:49 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #11896: ARROW-15005: [C++] Improve csv parser with Neon

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



##########
File path: cpp/src/arrow/csv/parser.cc
##########
@@ -184,6 +184,31 @@ class SSE42Filter {
   const BulkFilterType filter_;
 };
 
+#elif defined ARROW_HAVE_NEON
+
+// NEON filter: 8 bytes at a time, comparing with all special chars
+
+class NeonFilter {

Review comment:
       Is it doable to rewrite this using `xsimd`? That would make it more easily available with different SIMD instruction sets.

##########
File path: cpp/src/arrow/csv/parser.cc
##########
@@ -184,6 +184,31 @@ class SSE42Filter {
   const BulkFilterType filter_;
 };
 
+#elif defined ARROW_HAVE_NEON
+
+// NEON filter: 8 bytes at a time, comparing with all special chars
+
+class NeonFilter {
+ public:
+  using WordType = uint8x8_t;
+
+  explicit NeonFilter(const ParseOptions& options)
+      : delim_(vdup_n_u8(options.delimiter)),
+        quote_(vdup_n_u8(options.quoting ? options.quote_char : '\n')),
+        escape_(vdup_n_u8(options.escaping ? options.escape_char : '\n')) {}
+
+  bool Matches(WordType w) {
+    const uint8x8_t v = vceq_u8(w, vdup_n_u8('\r')) | vceq_u8(w, vdup_n_u8('\n')) |
+                        vceq_u8(w, delim_) | vceq_u8(w, quote_) | vceq_u8(w, escape_);

Review comment:
       Perhaps the filter classes should be templated with `SpecializedOptions`? This way, you would only check for quotes and escapes if needed.




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org