Skip to content

Use ByteBuffers for LZ4 OutputStream #11052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

xvrl
Copy link
Member

@xvrl xvrl commented Jul 14, 2021

Our current LZ4 OutputStream implementation allocates compression buffers
internally and relies on intermediate byte arrays for input and output buffers.

With this change we now use ByteBuffers internally, and as a result:

  • we write directly to the target ByteBuffer, avoiding an additional copy
  • we no longer allocate an output compression buffer, reducing allocations by half
  • we pave the way to make compression buffers reusable, similar to what we do
    for decompression

Our current LZ4 OutputStream implementation allocates compression buffers
internally and relies on intermediate byte arrays for input and output
buffers.

With this change we now use ByteBuffers internally, and as a result:
* we write directly to the target ByteBuffer, avoiding an additional copy
* we no longer allocate an output compression buffer, reducing
  allocations by half
* we pave the way to make compression buffers reusable, similar to
  what we do for decompression
Copy link

This PR is being marked as stale since it has not had any activity in 90 days. If you
would like to keep this PR alive, please leave a comment asking for a review. If the PR has
merge conflicts, update it with the latest from the base branch.

If you are having difficulty finding a reviewer, please reach out on the [mailing list](https://kafka.apache.org/contact).

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.

@github-actions github-actions bot added the stale Stale PRs label Dec 24, 2024
@github-actions github-actions bot removed the stale Stale PRs label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants