HaoYang670 opened a new issue #1351:
URL: https://github.com/apache/arrow-rs/issues/1351


   **Describe the bug**
   The function `StructArray::from` use `vec.push` in a for loop, which may 
cause many times of memory reallocation. What about using `Iterator::collect` 
Instead? Need your opinions.
   ```rust
   impl From<ArrayData> for StructArray {
       fn from(data: ArrayData) -> Self {
           let mut boxed_fields = vec![];
           for cd in data.child_data() {
               boxed_fields.push(make_array(cd.clone()));
           }
           Self { data, boxed_fields }
       }
   }
   ```
   
https://github.com/apache/arrow-rs/blob/master/arrow/src/array/array_struct.rs#L110-L114
   
   **To Reproduce**
   None
   
   **Expected behavior**
   Avoid using `vec.push` in a for loop
   
   **Additional context**
   None
   


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


Reply via email to