Skip to content

perf(selective): Add lightweight skip path in ChunkedDecoder#855

Open
kewang1024 wants to merge 2 commits into
facebookincubator:mainfrom
kewang1024:export-D106833350
Open

perf(selective): Add lightweight skip path in ChunkedDecoder#855
kewang1024 wants to merge 2 commits into
facebookincubator:mainfrom
kewang1024:export-D106833350

Conversation

@kewang1024

Copy link
Copy Markdown
Contributor

Summary:

  • Problem: skipWithoutIndex() called loadNextChunk() for every chunk, eagerly building the full encoding tree (Nullable → Dictionary → RLE → ...) via EncodingFactory::create() just to discard it with skip(remainingValues_)
  • Fix: Introduce skipNextChunk() — reads only the chunk header + EncodingPrefix row count (few bytes), skips whole chunks by pointer advance. Falls back to EncodingFactory::create() only for the final partial-skip chunk
  • Why here, not lazy in loadNextChunk(): loadNextChunk() has 8 other callers (readWithVisitorImpl, decodeNullable, testNulls, etc.) — all immediately read from the encoding, making lazy construction useless. skipWithoutIndex was the only caller building expensive trees to throw away
  • Perf: Skip 990K values across 990 chunks: 2450us → 144us (~17x faster)

Differential Revision: D106833350

Ke Wang added 2 commits June 11, 2026 01:20
…incubator#853)

Summary:

Improve accuracy and consistency of ChunkedDecoder section: fix function labels with `decoder_.`/`streamIndex_->` prefixes, unify box colors, swap panel order, remove redundant callouts, move `encoding_->skip(n)` to its own section, and update `EncodingFactory::create(chunkData)`.

Differential Revision: D108181646
Summary:
- **Problem**: `skipWithoutIndex()` called `loadNextChunk()` for every chunk, eagerly building the full encoding tree (Nullable → Dictionary → RLE → ...) via `EncodingFactory::create()` just to discard it with `skip(remainingValues_)`
- **Fix**: Introduce `skipNextChunk()` — reads only the chunk header + `EncodingPrefix` row count (few bytes), skips whole chunks by pointer advance. Falls back to `EncodingFactory::create()` only for the final partial-skip chunk
- **Why here, not lazy in `loadNextChunk()`**: `loadNextChunk()` has 8 other callers (`readWithVisitorImpl`, `decodeNullable`, `testNulls`, etc.) — all immediately read from the encoding, making lazy construction useless. `skipWithoutIndex` was the only caller building expensive trees to throw away
- **Perf**: Skip 990K values across 990 chunks: 2450us → 144us (~17x faster)

Differential Revision: D106833350
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 11, 2026
@meta-codesync

meta-codesync Bot commented Jun 11, 2026

Copy link
Copy Markdown

@kewang1024 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106833350.

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant