Skip to content

feat: reduce temp copy when decompressing lz4 frame#9308

Draft
zhaohaidao wants to merge 1 commit intoapache:mainfrom
zhaohaidao:feat/lz4-reduce-copy
Draft

feat: reduce temp copy when decompressing lz4 frame#9308
zhaohaidao wants to merge 1 commit intoapache:mainfrom
zhaohaidao:feat/lz4-reduce-copy

Conversation

@zhaohaidao
Copy link

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jan 30, 2026
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution @zhaohaidao

Did you run any benchmarks to measure the performance improvement of this PR?

If you need some new benchmarks, it would be nice to add them as a separate PR so that we can use our automated testing infrastructure to compare

This strongly suggests the streaming FrameDecoder path (state machine + Read trait + buffer resize/zero-init) adds significant overhead beyond core LZ4 block decompression.

If the issue is optimizing the lz4 frame decoding, that might be better done in the lz4 layer 🤔 Have considered contributing this change upstream to the lz4_flex crate?

[features]
default = []
lz4 = ["lz4_flex"]
lz4_direct = ["lz4", "twox-hash"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this feature flagged? Is there any reason a user would NOT want this feature?

If we are going to add a new feature it also need to be documented

@alamb alamb marked this pull request as draft February 2, 2026 16:41
@alamb
Copy link
Contributor

alamb commented Feb 2, 2026

Marking as draft as I think this PR is no longer waiting on feedback and I am trying to make it easier to find PRs in need of review. Please mark it as ready for review when it is ready for another look

@zhaohaidao
Copy link
Author

Marking as draft as I think this PR is no longer waiting on feedback and I am trying to make it easier to find PRs in need of review. Please mark it as ready for review when it is ready for another look

Thanks for marking it. I'm currently adding benchmarks based on the comments. The hotspot I'm encountering right now might be related to buffer/IO management in the arrow IPC path, so I'm still inclined to optimize arrow-rs for now. However, I will follow your suggestion and add benchmarks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: reduce temp copy when decompressing lz4 frame

2 participants