cyb70289 commented on a change in pull request #12504:
URL: https://github.com/apache/arrow/pull/12504#discussion_r814444011
##########
File path: cpp/src/arrow/csv/writer.cc
##########
@@ -81,7 +81,15 @@ RecordBatchIterator RecordBatchSliceIterator(const
RecordBatch& batch,
// Counts the number of quotes in s.
int64_t CountQuotes(arrow::util::string_view s) {
- return static_cast<int64_t>(std::count(s.begin(), s.end(), '"'));
+ // std::count uses 64 bit counter, not necessary for StringType
Review comment:
An easy approach might be to check s.size(), if it can fit in 32 bits,
go the 32 bit code, otherwise call std::count directly.
Per my test, there's no performance loss, probably because the branch is
almost always correctly predicted.
Will try refine this code, at least it should static_assert if we use
LargeString.
--
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]