pitrou commented on a change in pull request #12504: URL: https://github.com/apache/arrow/pull/12504#discussion_r815964918
########## File path: cpp/src/arrow/csv/writer.cc ########## @@ -328,6 +351,26 @@ class QuotedColumnPopulator : public ColumnPopulator { } private: + // Returns true if there's no quote in the string array + // similar to std::find, but with much better performance + static bool NoQuoteInArray(const StringArray& array) { + const uint8_t* data = array.raw_data() + array.value_offset(0); + const int64_t buffer_size = array.total_values_length(); + const uint8_t* const data_end = data + buffer_size; + + for (int64_t i = 0; i < buffer_size / 16; ++i) { + bool r = false; + for (int i = 0; i < 16; ++i) { + r |= data[i] == '"'; + } Review comment: How does this compare to simply using `memchr`? At least on glibc it should be heavily optimized. I have no idea on macOS or Windows. -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org