Skip to content

perf(kernel): bind typed cell readers once per batch - #601

Closed
vuanhphung wants to merge 4 commits into
mainfrom
perf/typed-cells
Closed

vuanhphung wants to merge 4 commits into
mainfrom
perf/typed-cells

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Kernel row iteration repeats Arrow dispatch and null/accessor checks per cell (scanCell, including decimal formatting, accounts for 54.1% of the 500 MB profile). Independent review reproduced about 4% less catalog user CPU across 28 fresh-process pairs: 5.385 → 5.165 s, with a paired bootstrap 95% CI of -4.9% to -2.9%. Elapsed improves 2–7% depending on cohort. The 0.220 s CPU saving is 2.04 ns/cell, or about 70 ns/row against main's 1.70 µs/row.

Bind scalar readers once per column per batch, lazily on the first row, and clear their references before batch release. Preserve native widths, NTZ/location decisions, string cloning, wrapped errors, options and existing decimal/nested/geospatial scanning. Only the kernel uses the helper; Thrift and defaults are unchanged. Reader state stays O(columns); a one-row batch adds 28 ns/56 B, with no resolvable change for small live queries. This is separate from #600's fetch change, #599's parked decimal arena and #514's IPC work.

Verification: default/tagged kernel suites, touched-package race and lint; parity/lifecycle tests kill 16 non-equivalent mutants, including missing-bitmap/schema-count guards. C Data sliced-record parity covers nullable and absent-bitmap columns. Eight full-result checksum pairs match, including nulls/limits/close/cancel. Live kernel/type parity passes 18/19 (the unrelated telemetry failure reproduces on main); six Thrift e2e tests pass without skips.

Independent live reproduction User CPU change Elapsed change
Catalog, 3.165M × 34 cells (28 pairs) -4.1% -1.7% to -6.9% (3 cohorts)
Boolean, 80M rows (8 pairs) -5.5% -2.4%
Float, 50M rows (6 pairs) -5.0% -5.1%
Double, 30M rows (6 pairs) -4.5% +0.4%
Inline LIMIT 10000 / SELECT 1 Not resolved Not resolved

Adversarial review: converged in round 1; conservative results and all agreed findings addressed. Two-model/judge bot review approved cf3e9f9 with no issues.

This pull request and its description were written by Isaac.

vuanhphung and others added 3 commits November 27, 2026 05:49
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@vuanhphung vuanhphung changed the title Bind typed kernel cell readers once per batch perf(kernel): bind typed cell readers once per batch Nov 27, 2026
@vuanhphung
vuanhphung marked this pull request as ready for review November 27, 2026 07:28

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

@vuanhphung

Copy link
Copy Markdown
Collaborator Author

Closing: the reproduced gain (~4% CPU on the kernel row path) is below our 5% bar for this change.

@vuanhphung vuanhphung closed this Dec 1, 2026
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