Skip to content

perf(kernel): amortize DECIMAL string allocations - #599

Draft
vuanhphung wants to merge 3 commits into
mainfrom
perf/dec-arena
Draft

vuanhphung wants to merge 3 commits into
mainfrom
perf/dec-arena

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Top-level kernel DECIMAL formatting accounts for 27% of catalog-scan allocation objects. Append into immutable Go-owned chunks, starting at 64 B and doubling to 4 KiB, with one arena per DECIMAL column and no batch reset; Thrift, float mode, nested JSON and Arrow batches are unchanged. Adjacent overlap: #514, #437, #513 and #597.

A retained string can pin up to 4 KiB of other values from its column (keeping every 100th row retains 29.7 -> 376.1 MiB), so callers retaining a few values can use strings.Clone.

Verification: pure-Go/kernel units, race/checkptr, default/changed-code tagged lint, 43 live e2e passes, 10 complete value/type/metadata checksums, 14 assertion-failing mutants and the noCopy vet probe pass. Go 1.27.3/bindings v1.5.0; ABBA fresh processes, warmup discarded, 10 local and 8 live samples/side. Table shows median / p95.

Scenario Main Candidate
Local decimal, ns/cell 41.93 / 45.66 35.38 / 39.96
Local catalog, ns/cell 26.34 / 27.92 23.84 / 25.09
Local no-decimal, ns/cell 12.13 / 16.43 12.44 / 15.14
Local float mode, ns/cell 15.38 / 16.05 16.04 / 16.96
Local warm 8-row batch, ns/cell 26.33 / 35.78 23.86 / 27.31
Local fresh 1-row result, ns 263.4 / 298.0 363.9 / 411.4
Live 500 MB drain, s 4.374 / 4.871 4.187 / 4.741
Live 500 MB total, s 5.972 / 6.390 5.756 / 6.266
Live 100 MB drain, s 0.924 / 1.273 0.838 / 0.911
Live 100 MB total, s 1.899 / 2.699 1.893 / 1.953

Do not ship this SHA: 500 MB drain 4.26% and total 3.60% gains miss the ~5% end-to-end bar; controlled saving is 85 ns/row (~4.5%). One-row results still cost +101 ns/+202 B; 100k cached point values retain 4.58 -> 9.16 MiB, while keeping one whole column improves 141.83 -> 118.35 MiB.

Adversarial review: round 1 findings addressed; re-review pending, keep draft.

This pull request and its description were written by Isaac.

vuanhphung and others added 2 commits November 27, 2026 03:48
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 Share bounded string chunks for kernel decimal values Amortize kernel DECIMAL string allocations Nov 27, 2026
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@vuanhphung vuanhphung changed the title Amortize kernel DECIMAL string allocations perf(kernel): amortize DECIMAL string allocations Nov 27, 2026

This branch has not been deployed

No deployments
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