Skip to content

perf(reader): gather dict and window folds straight off their segments - #600

Merged
dfa1 merged 1 commit into
mainfrom
perf/dict-flat-gather
Oct 24, 2026
Merged

dfa1 merged 1 commit into
mainfrom
perf/dict-flat-gather

Conversation

@dfa1

@dfa1 dfa1 commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Profiling ParquetVsVortexReadBenchmark.vortexReadMultiColumn showed per-row virtual calls dominating: an ALP-encoded dict pool re-decoded on every gathered row, and the dict and scan-window folds went through getShort/getDouble/getInt per row.

  • Floating dict pools are decoded once (Rust canonicalizes dict values before taking). Integer pools stay lazy: decoding them polluted the gather type profile and cost TPC-DS store_sales 3.5%.
  • DictDoubleArray.fold, DictIntArray.materialize, OffsetIntArray.fold, OffsetDoubleArray.fold read flat segments directly.

Two-column taxi read, 3 forks: 156.7 → 162.0 ops/s (+3.4%), still behind Parquet batch (221). RealFileScanBenchmark A/B on all seven real files, interleaved, 2 forks: all within noise (bi-corporations and store_sales re-checked at 3 forks).

New unit tests compare each fast path against the per-row path with an order-sensitive fold operator. Full ./mvnw verify passes locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SwhK4W5cgj7y7s4ZPCif5x

The two-column taxi read (ParquetVsVortexReadBenchmark, fare_amount +
PULocationID) spent its time in per-row virtual calls:

- a vortex.dict whose pool is ALP-encoded re-ran the ALP multiply for
  every row it gathered; a floating pool is now decoded once, as Rust's
  dict canonicalizes its values before taking. Integer pools stay lazy:
  FoR costs an add a row, and decoding them shifted the gathers' type
  profile enough to cost the TPC-DS store_sales scan 3.5%.
- DictDoubleArray.fold and DictIntArray.materialize read a flat pool
  and flat u8/u16 codes off their segments instead of through getShort
  and getDouble/getInt.
- OffsetIntArray and OffsetDoubleArray, the scan windows over a shared
  flat, fold the window off its segment instead of inheriting the
  per-row default.

ParquetVsVortexReadBenchmark.vortexReadMultiColumn, M5, Zulu 25.0.2,
3 forks: 156.7 -> 162.0 ops/s (+3.4%). RealFileScanBenchmark on all
seven real files, base and change interleaved, 2 forks: every file
within noise.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SwhK4W5cgj7y7s4ZPCif5x
@dfa1
dfa1 force-pushed the perf/dict-flat-gather branch from daf87e6 to 27aa66d Compare October 24, 2026 15:41
@dfa1
dfa1 merged commit effb8f0 into main Oct 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant