Repository navigation
perf: cheaper cascading writes (ALP-RD, string min/max, float stats) - #543
Merged
Merged
Conversation
dfa1
force-pushed
the
perf/alprd-and-dict-stats
branch
from
October 16, 2026 21:05
48dd607 to
11f6d0f
Compare
The dictionary search counted left-bit patterns in a HashMap<Short,Integer> per cut, the per-row code lookup went through a boxed Map<Short,Short>, and exceptions were collected in List<Long>/List<Short>. Count with LongIntMap, scan the (at most 8 entry) dictionary linearly, and keep exceptions in primitive arrays. Selection order is unchanged: most frequent first, ties by ascending unsigned pattern (Rust's select_dictionary). JavaVsJniWriteBenchmark.javaWrite depth=3, -f 3: 0.878 -> 1.057 ops/s (error intervals overlap, machine noisy). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
DictColumnState.ingestDictChunk already maps every row to a code, but then VarBinEncodingEncoder.minMaxStats re-scanned all rows with two UTF-8-order comparisons each (~4.5% of CPU in a cascading write profile). A chunk's extremes depend only on its distinct values, so compare a code the first time it appears in the chunk. Per-code stamps avoid clearing a flag array per chunk. Adds a test pinning per-chunk results across chunks that share and do not share codes, and the UTF-8 vs UTF-16 order of a supplementary character. Interleaved A/B on javaWrite depth=3: 0.709 -> 0.751 ops/s, within noise. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
scanF16/F32/F64 probed the hash map for every row, ~10% of CPU in a cascading write profile. Count a run of equal bit patterns with one probe, as the integer path already does (#10037/#10041 in Rust for ints). Counts are exactly the per-row ones, so every encoder verdict is unchanged; Rust probes every row, this changes cost only. Keys stay raw bits, so NaN and -0.0 remain distinct patterns. Adds a brute-force reference test over runny and scattered F16/F32/F64 inputs. Interleaved A/B on javaWrite depth=3: 1.088 -> 1.131 ops/s, within noise. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
dfa1
force-pushed
the
perf/alprd-and-dict-stats
branch
from
October 17, 2026 10:07
11f6d0f to
a48e11b
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
Three independent write-path optimizations found by profiling
JavaVsJniWriteBenchmark.javaWrite(depth 3) with YourKit async CPU sampling. None changes what is written: the encoder verdicts and bytes stay the same.LongIntMapinstead of a boxedHashMap, scan the (at most 8 entry) dictionary linearly instead of a boxedMap<Short,Short>lookup per row, and keep exceptions in primitive arrays. Selection order is unchanged (most frequent first, ties by ascending unsigned pattern, as Rust'sselect_dictionary); new F64/F32 tests pin the unsigned tie-break for sign-bit-set patterns.Measurements
javaWritedepth 3, interleaved A/B againstmain,-f 2, quiet machine:With
-XX:+UseCompactObjectHeaders: 1.032 vs 1.149 ops/s, same 12.7% allocation drop. Per-commit gains are within noise individually; the allocation figure is the solid one.Review
Reviewed by an Opus subagent (no serious findings). Its two should-fix items are addressed in the commits: the stamp array sizing and the missing unsigned tie-break tests.
Test plan
./mvnw verify(all modules, 2888 integration tests, javadoc)🤖 Generated with Claude Code