Add native Zstd input and output streams#315
Open
dain wants to merge 2 commits intoairlift:masterfrom
Open
Conversation
3ed8972 to
c287744
Compare
findepi
reviewed
Feb 3, 2026
| this.useNative = useNative; | ||
| } | ||
|
|
||
| private void createDecompressingStreamIfNecessary() |
Contributor
There was a problem hiding this comment.
Why not pre-create in constructor?
(Might be worth code comment)
Member
Author
There was a problem hiding this comment.
There is a good reason to delay construction here.
- ZstdNativeInputStream allocates native stream state in its constructor (createDecompressStream + arena setup), so lazy init avoids that cost when a codec stream is created but never actually read.
- It also avoids re-allocating immediately on resetState(); current code resets to null and recreates on next read
I added comments
| this(true); // Default to native when available | ||
| } | ||
|
|
||
| public ZstdHadoopStreams(boolean useNative) |
Member
Author
There was a problem hiding this comment.
This is what the other hadoop streams use, like Lz4HadoopStreams.java (line 30)
| import static java.util.Objects.requireNonNull; | ||
| import static sun.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET; | ||
|
|
||
| public final class ZstdJavaInputStream |
Contributor
There was a problem hiding this comment.
Is it possible to structure git changes in a way that this doesn't appear as all new code?
(Perhaps rename as separate commit?)
c287744 to
20b0a4e
Compare
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.
No description provided.