Optimize C++ batch decode and output fast paths - #898
Open
ColinLeeo wants to merge 2 commits into
Open
Conversation
ColinLeeo
force-pushed
the
feature/cpp-decoder-bulk-fast-paths
branch
from
August 5, 2026 09:19
5622e85 to
d0ccf95
Compare
ColinLeeo
marked this pull request as ready for review
August 5, 2026 11:15
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.
What changed
This PR adds four local C++ fast paths to the existing batch read pipeline. It does not add a new query mechanism, cache, persistent index, public API, or file-format change.
bit_width == 0, meaning all delta residuals are zerostd::fill_n, with one output-position updateWhy
The optimized batch decoders already produce contiguous timestamp and value arrays, but dense aligned reads copied them into TsBlock vectors one row at a time. Evenly spaced TS2DIFF blocks also fell through to scalar residual reconstruction despite containing no packed residual bytes. Gorilla repeated values still invoked the normal per-value control path even when long zero-control runs were available.
These cases are common in regularly sampled time-series data and can be handled without changing query semantics.
Impact
Performance
The benchmark harness used query setup, metadata reuse, and page seeking that are deliberately not part of this PR. Absolute latency and throughput are therefore omitted. The table reports only the incremental speedup of each local fast path against the immediately preceding implementation under otherwise identical conditions.
1.89xthroughput1.30xthroughput1.11xthroughput1.72%lower median latencyThese are workload-specific A/B results for the changed code paths, not a general storage throughput guarantee. They should not be multiplied into a cumulative figure because the measurements were collected at separate optimization checkpoints.
Validation
TsFile_Testwith RelWithDebInfo,ENABLE_SIMD=ON, andENABLE_ANTLR4=OFF.TsBlockTest,EncodingCoverage,GorillaCodecTest, andTsFileReaderTesttests passed; one unrelated large-file test remains disabled upstream../mvnw -P with-cpp -DskipTests spotless:checkpassed.git diff --checkpassed.New coverage includes exact-capacity fixed-width appends, dense/null/filtered aligned scans, positive and negative evenly spaced TS2DIFF blocks, long Gorilla runs crossing reservoir and batch boundaries, scalar/batch state transitions, truncated input, embedded NaN handling, non-canonical NaN payloads, and negative zero.