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



##########
File path: cpp/src/arrow/csv/writer.cc
##########
@@ -136,15 +134,14 @@ class ColumnPopulator {
   MemoryPool* const pool_;
 };
 
-// Copies the contents of to out properly escaping any necessary characters.
-// Returns the position prior to last copied character (out_end is 
decremented).
-char* EscapeReverse(arrow::util::string_view s, char* out_end) {
-  for (const char* val = s.data() + s.length() - 1; val >= s.data(); val--, 
out_end--) {
-    if (*val == '"') {
-      *out_end = *val;
-      out_end--;
+// Copies the contents of s to out properly escaping any necessary characters.
+// Returns the position next to last copied character.
+char* Escape(arrow::util::string_view s, char* out_end) {
+  for (const char c : s) {

Review comment:
       Yes. It's the main reason I change the scan order. This function is the 
hotspot of string with quotes benchmark. Reverse scanning makes it hard to 
improve, the output string header pos is not known until end.




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


Reply via email to