Repository navigation
perf: cut flush encoding allocations and page-write copies - #1133
Open
luoluoyuyu wants to merge 1 commit into
Open
luoluoyuyu wants to merge 1 commit into
luoluoyuyu wants to merge 1 commit into
Conversation
Reduce allocations, boxing and buffer copies in the page/chunk write path without changing chunk size, page size or produced bytes. - reuse page body ByteBuffer and compressed byte[] per writer, and reuse RLE bit-pack scratch buffers - pre-size page writer buffers and grow the chunk page buffer once after the first page - reset chunk writer page-sizing state when a writer is reused - remove the per-value lambda and Integer boxing from the dictionary encoder; encode int RLE values from a primitive buffer - write the first page statistics up front for multi-page chunks instead of copying the whole chunk buffer, and compact in place for single-page chunks - batch Gorilla/Chimp bit writes through a 64-bit accumulator and account for buffered bytes when sizing pages
luoluoyuyu
force-pushed
the
perf/flush-encode-gc-dev
branch
from
November 19, 2026 07:21
87f3dfb to
9363e26
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.
Summary
Reduce allocations, boxing and buffer copies in the page/chunk write path, without changing chunk size, page size or produced bytes.
ByteBufferand the compressed outputbyte[]per writer (PageBodyBuffer), and reuse the RLE bit-pack scratch buffer.Integerboxing from the dictionary encoder; encode int RLE values from a primitive buffer.The dictionary index intentionally keeps
HashMap(without the per-value lambda): an open-addressing variant saved ~0.55 MiB per encode but made dictionary encoding ~16% slower in a same-branch A/B, so it was reverted.Results
Local IoTDB flush benchmark (200k rows x 6 columns, deterministic allocation):
Allocation numbers are deterministic; CPU/wall time varies by machine.
Compatibility
Test plan
./mvnw -P with-java -pl java/tsfile -am -Dtest=GorillaDecoderV2Test,ChimpDecoderTest,GorillaDecoderV1Test,IntRleDecoderTest,LongRleDecoderTest,DictionaryDecoderTest,PageWriterTest,ValuePageWriterTest,TimePageWriterTest,PageBodyEncoderTest testspotless:apply