Dandandan commented on code in PR #9093:
URL: https://github.com/apache/arrow-rs/pull/9093#discussion_r2711117647


##########
parquet/src/arrow/record_reader/mod.rs:
##########
@@ -169,7 +176,9 @@ where
     /// Returns currently stored buffer data.
     /// The side effect is similar to `consume_def_levels`.
     pub fn consume_record_data(&mut self) -> V {
-        std::mem::take(&mut self.values)
+        // Replace the buffer with a new one that has the same capacity
+        // This avoids reallocations on subsequent batches
+        std::mem::replace(&mut self.values, 
V::with_capacity(self.capacity_hint))

Review Comment:
   Can we avoid this allocation by moving it to where we write? 



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