Avoid over-reserving Vecs in compression codecs - #10483
Open
MassivePizza wants to merge 5 commits into
Open
Conversation
MassivePizza
marked this pull request as ready for review
July 29, 2026 14:57
MassivePizza
marked this pull request as draft
July 29, 2026 15:11
MassivePizza
marked this pull request as ready for review
July 29, 2026 16:07
Contributor
|
run benchmark compression |
This comment was marked as duplicate.
This comment was marked as duplicate.
|
🤖 Arrow criterion benchmark completed (GKE) | trigger Instance: CPU Details (lscpu)Details
Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
mapleFU
reviewed
Jul 30, 2026
| if to_flush == 0 { | ||
| break; | ||
| } | ||
| output_buf.reserve_exact(to_flush); |
Member
There was a problem hiding this comment.
Emmm calling reserve_exact in a loop is a bit weird, does this guranteed calling once?
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?
This is a continuation to PR #10345.
Rationale for this change
The Vecs that we over-reserved can be long-lived, see issue above.
What changes are included in this PR?
Use zstd_safe contexts directly to compress/decompress, allowing us to append to Vec without reserving excessive amounts.
Remove redundant loops in
LZ4Codec.Are these changes tested?
Should be covered by existing tests.
One thing I felt while looking was the lack of tests regarding compression frames (some codecs look like they may decompress too much or not enough). Could add tests for that if desired.
Are there any user-facing changes?
No.