alamb opened a new issue, #7273:
URL: https://github.com/apache/arrow-rs/issues/7273

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   While reviewing https://github.com/apache/arrow-rs/pull/7263 from 
@zhuqi-lucas I noticed that the json reader is allocating a new for each string 
field it parses 
   
   
https://github.com/apache/arrow-rs/blob/f4fde769ab6e1a9b75f890b7f8b47bc22800830b/arrow-json/src/reader/string_array.rs#L110-L120
   
   
   
   **Describe the solution you'd like**
   
   I would like to make the json reader faster by not allocating in the inner 
loop
   
   **Describe alternatives you've considered**
   
   I think instead of doing 
   ```rust
   for ... {
     builder.append_value(n.to_string())
   }
   ```
   
   A typically faster pattern is
   
   ```rust
   // temp buffer
   let mut s = String::new();
   
   for ... {
     s.clear(); // reuse allocation
     write!(&mut s, "{n}");
     builder.append_value(s)
   }
   ```
     
   
   **Additional context**
   <!--
   Add any other context or screenshots about the feature request here.
   -->
   


-- 
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.apache.org

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

Reply via email to