Add validity fast-path helper for the four pattern-matching encoders#7995
Closed
joseph-isaacs wants to merge 1 commit into
Closed
Add validity fast-path helper for the four pattern-matching encoders#7995joseph-isaacs wants to merge 1 commit into
joseph-isaacs wants to merge 1 commit into
Conversation
…h it
Most production columns are non-nullable or `AllValid`, in which case
the per-row `mask.value(i)` branch is dead weight. Introduce a
`ValidityKind { AllValid, Mask(...) }` helper resolved exactly once per
column, and pattern-match on it in the four encoders that loop over
rows: `encode_primitive_typed`, `encode_bool`, `encode_varbinview`,
`add_size_varbinview`.
For NonNullable / AllValid columns this skips the mask materialization
entirely, and the inner loop has no validity branch. For nullable
columns the materialized mask is held once instead of re-resolved per
row.
Yields ~10% across canonical paths on isolated runs; combines with the
later auto-vectorization commit because removing the per-row branch
makes the inner loop a candidate for the compiler's vectorizer.
Signed-off-by: Claude <noreply@anthropic.com>
This was referenced May 18, 2026
This was referenced May 18, 2026
Closed
Merging this PR will not alter performance
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | chunked_varbinview_canonical_into[(100, 100)] |
273.3 µs | 309 µs | -11.56% |
| ⚡ | Simulation | chunked_varbinview_canonical_into[(1000, 10)] |
197.9 µs | 161.9 µs | +22.25% |
| ⚡ | Simulation | chunked_varbinview_into_canonical[(100, 100)] |
358.4 µs | 325 µs | +10.26% |
| ❌ | Simulation | new_alp_prim_test_between[f32, 16384] |
103.9 µs | 118.3 µs | -12.18% |
| ❌ | Simulation | new_alp_prim_test_between[f32, 32768] |
153.3 µs | 182.1 µs | -15.82% |
| ⚡ | Simulation | iter_arrow_buffer[128] |
919.4 ns | 831.9 ns | +10.52% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/row-c10-validity-fast-path (7de4dcc) with develop (faf7e42)1
Footnotes
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.
Part 10 of 25 in the stacked PR series adding
vortex-row.This PR contains exactly one commit; review just that diff in isolation.
Note: the PR title is a shortened version of the original commit title (which is 73 chars: "Add validity fast-path helper for the four encoders that pattern-match it"). The commit message itself is unchanged.
What this commit does
Most production columns are non-nullable or
AllValid, in which case the per-rowmask.value(i)branch is dead weight. Introduces aValidityKind { AllValid, Mask(...) }helper resolved exactly once per column, and pattern-matches on it in the four encoders that loop over rows:encode_primitive_typed,encode_bool,encode_varbinview,add_size_varbinview.For NonNullable / AllValid columns this skips the mask materialization entirely, and the inner loop has no validity branch. For nullable columns the materialized mask is held once instead of re-resolved per row.
Yields ~10% across canonical paths on isolated runs; combines with the later auto-vectorization commit because removing the per-row branch makes the inner loop a candidate for the compiler's vectorizer.
Stack
claude/row-c01-crate-scaffoldingclaude/row-c02-sortfield-optionsclaude/row-c03-codec-fixed-widthclaude/row-c04-codec-varlenclaude/row-c05-codec-nestedclaude/row-c06-rowsize-scalarfnclaude/row-c07-rowencode-scalarfnclaude/row-c08-convert-columns-tests-benchclaude/row-c09-skip-listview-validationclaude/row-c10-validity-fast-pathclaude/row-c11-skip-zero-initclaude/row-c12-vectorize-pure-fixed-offsetsclaude/row-c13-vectorize-mixed-offsetsclaude/row-c14-varlen-block-copy-nonoverlappingclaude/row-c15-walk-varbinview-directlyclaude/row-c16-arith-write-fast-pathclaude/row-c17-specialize-constant-arithclaude/row-c18-kernel-dispatch-helpersclaude/row-c19-inventory-registryclaude/row-c20-constant-kernelclaude/row-c21-dict-kernelclaude/row-c22-patched-kernelclaude/row-c23-runend-kernelclaude/row-c24-bitpacked-kernelclaude/row-pr3-kernelsBase of this PR: #7994 (
claude/row-c09-skip-listview-validation)Next in stack: #7996 (
claude/row-c11-skip-zero-init)Combined context
For the full design + rationale, see PR #7985 (top of stack).