parquet: reduce clone in delta byte array decoder#9282
Merged
Dandandan merged 1 commit intoapache:mainfrom Jan 31, 2026
Merged
Conversation
9816f38 to
2ac0261
Compare
2ac0261 to
0719229
Compare
Contributor
|
run bemchmark arrow_reader |
Contributor
|
run benchmark arrow_reader |
|
🤖 |
|
🤖: Benchmark completed Details
|
alamb
approved these changes
Jan 30, 2026
| result.extend_from_slice(&self.previous_value[0..prefix_len]); | ||
| result.extend_from_slice(suffix); | ||
|
|
||
| let data = Bytes::from(result.clone()); |
Contributor
There was a problem hiding this comment.
this certainly seems to save a clone. Looks good to me 👍
|
|
||
| // Concatenate prefix with suffix | ||
| let mut result = Vec::new(); | ||
| let mut result = Vec::with_capacity(prefix_len + suffix.len()); |
Contributor
There was a problem hiding this comment.
makes sense to allocate the correct size.
Dandandan
approved these changes
Jan 31, 2026
Contributor
|
Thanks @lyang24 ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
small optimization
Rationale for this change
key insight is the byte clone is cheap just a ref count compare to vec clone is a alloc + memcopy.
before
after
What changes are included in this PR?
previous_value type changed to Bytes
preallocate result vec capacity.
Are these changes tested?
the existing test should pass
Are there any user-facing changes?
no