MassivePizza commented on code in PR #10364:
URL: https://github.com/apache/arrow-rs/pull/10364#discussion_r3615872563


##########
parquet/src/arrow/arrow_writer/mod.rs:
##########
@@ -1834,14 +1834,15 @@ fn get_interval_ym_array_slice(
     array: &arrow_array::IntervalYearMonthArray,
     indices: impl ExactSizeIterator<Item = usize>,
 ) -> Vec<FixedLenByteArray> {
-    let mut values = Vec::with_capacity(indices.len());
+    const VALUE_SIZE: usize = 12;
+    let mut arena = Vec::with_capacity(indices.len() * VALUE_SIZE);
     for i in indices {
-        let mut value = array.value(i).to_le_bytes().to_vec();
-        let mut suffix = vec![0; 8];
-        value.append(&mut suffix);
-        values.push(FixedLenByteArray::from(ByteArray::from(value)))
+        let mut out = [0; 12];
+        let value = array.value(i);
+        out[0..4].copy_from_slice(&value.to_le_bytes());
+        arena.extend_from_slice(&out);

Review Comment:
   Looked at the codegen, and it avoided some XORs. The real benefit came from 
rewriting it to use `chunks_exact_mut.` (see 
https://github.com/apache/arrow-rs/pull/10364/changes/baa13dd29c458595eb6913fc2a24885309cbf6c1)



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