alamb commented on code in PR #9282:
URL: https://github.com/apache/arrow-rs/pull/9282#discussion_r2747330812
##########
parquet/src/encodings/decoding.rs:
##########
@@ -1081,14 +1082,14 @@ impl<T: DataType> Decoder<T> for
DeltaByteArrayDecoder<T> {
let prefix_len = self.prefix_lengths[self.current_idx] as
usize;
// Concatenate prefix with suffix
- let mut result = Vec::new();
+ let mut result = Vec::with_capacity(prefix_len +
suffix.len());
result.extend_from_slice(&self.previous_value[0..prefix_len]);
result.extend_from_slice(suffix);
- let data = Bytes::from(result.clone());
Review Comment:
this certainly seems to save a clone. Looks good to me 👍
##########
parquet/src/encodings/decoding.rs:
##########
@@ -1081,14 +1082,14 @@ impl<T: DataType> Decoder<T> for
DeltaByteArrayDecoder<T> {
let prefix_len = self.prefix_lengths[self.current_idx] as
usize;
// Concatenate prefix with suffix
- let mut result = Vec::new();
+ let mut result = Vec::with_capacity(prefix_len +
suffix.len());
Review Comment:
makes sense to allocate the correct size.
--
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]