Jefffrey commented on code in PR #10364:
URL: https://github.com/apache/arrow-rs/pull/10364#discussion_r3607366931
##########
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:
would it make a difference to change arena to `vec![0; indices.len() *
VALUE_SIZE]` then use `copy_from_slice` into offsets to arena to avoid this
intermediate `out`?
--
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]