Repository navigation
feat(benchmarks): add dict_encoding_sweep harness - #26250
Draft
Rich-T-kid wants to merge 1 commit into
Draft
Rich-T-kid wants to merge 1 commit into
Rich-T-kid wants to merge 1 commit into
Conversation
Introduces `dict_encoding_sweep`, a focused benchmark driver that compares `Dictionary<Int32, Utf8>` against `Utf8View` for the same operator across a cardinality sweep. For each cell it generates two in-memory tables sharing identical values, runs the same SQL against each, and reports median / min / p25 / p75 runtimes to CSV so the dict vs view crossover is directly visible. The harness covers scan, filter, project, aggregation, sort, join, limit, repartition, coalesce_batches, coalesce_partitions, and spm groups. The README section documents operator groups, flags, and CSV schema so other contributors can reproduce the numbers without touching the harness. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #26250 +/- ##
==========================================
- Coverage 82.83% 82.72% -0.12%
==========================================
Files 1149 1151 +2
Lines 452724 453314 +590
Branches 452724 453314 +590
==========================================
- Hits 375022 375009 -13
- Misses 54881 55481 +600
- Partials 22821 22824 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
will keep this PR in draft mode and wait for the next arrow-rs bump as apache/arrow-rs#11407 should close the gap for the sort operator, and #26186 & #25874 will remove the un-needed cast in the project operator. Good results overall, once the parquet scan speed up is in I expect dictionarys to be faster than utf8View for low to medium queries |
This was referenced Oct 13, 2026
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.
Which issue does this PR close?
Rationale for this change
Several recent PRs that touch dictionary /
Utf8Viewoperator paths have hadto answer the same question: "at what cardinality does dictionary encoding
stop being a win over
Utf8View?" There is no in-tree harness that answersthis reproducibly — contributors have been spinning up ad-hoc scripts, each
measuring slightly different things.
This PR adds
dict_encoding_sweep: a focused benchmark driver that generatestwo in-memory tables sharing identical values (one
Utf8View, oneDictionary<Int32, Utf8>), runs the same SQL against each, and reportsmedian/min/p25/p75 runtimes to CSV. One invocation sweeps across an NDV
grid for a chosen operator group so the crossover point is directly visible.
What changes are included in this PR?
benchmarks/src/dict_encoding_sweep.rs— harness library (deterministicdata gen, interleaved warmup/timing loop, per-group query catalog, CSV
writer).
benchmarks/src/bin/dict_encoding_sweep.rs— CLI driver; one invocationhandles one
(group, rows, width, nulls, batch_size)combination andsweeps across the provided
--ndvs.benchmarks/README.md— new Dictionary vs Utf8View Encoding Sweepsection documenting operator groups, flags, and CSV schema.
Nothing under
datafusion/is touched.What is the testing strategy for this PR?
The sweep binary is itself the artifact — a smoke run (
--rows 100000 --ndvs 10,1000 --iters 3 --warmups 1) completes end-to-end and writes a valid CSV.No new unit tests are added; the harness is a self-contained reproduction
tool rather than a code path exercised by production queries.
cargo fmt --all --checkandcargo clippy -p datafusion-benchmarks --lib --bins --all-features -- -D warningsboth pass on the new files.Are there any user-facing changes?
No. New files under
benchmarks/.Results
Numbers below come from running the harness on this branch, 2026-10-12, with
--iters 15 --warmups 3 --dict-chunk 100000 --ndvs 10,100,500,1000,2000,3000,4000,8192. Cells aredict median / view median— values< 1.00mean dictionary is faster,> 1.00meansUtf8Viewwins. Variance on this machine is roughly ±20 %; treatdifferences inside that band as noise. Full CSVs are reproducible from the
commands in
benchmarks/README.md.filter — 1,000,000 rows
filter — 5,000,000 rows
aggregation — 1,000,000 rows
aggregation — 5,000,000 rows
sort — 1,000,000 rows
sort — 5,000,000 rows
project — 1,000,000 rows
project — 5,000,000 rows
join — 1,000,000 rows
join — 5,000,000 rows
Headline takeaways consistent across both row counts:
1.00right around NDV 2000 at bothrow counts;
in10,like_prefix, and1pct_groupstay dict-favourablewell past 3000.
sort_k/sort_k_descare still dict-favourable at 2k–3k(0.74–1.03) and cross around NDV 4000;
sort_k_limit_1000andsort_v_by_kcross earlier (~1k–2k);sort_kwis a persistent dictregression (ties-breaker column).
only at 4k–8k does it drift to 0.78–0.94 (still dict-favourable).
proj_lengthandproj_upperare dict runaways(0.01–0.14) through 3000;
proj_substris a persistentUtf8Viewwin.Utf8Viewedge(~1.05–1.26×) past 4000.