Skip to content

bench: cover dictionary group keys with a shared values array - #25198

Open
LiaCastaneda wants to merge 1 commit into
apache:mainfrom
LiaCastaneda:bench/dict-group-values-shared-arc
Open

bench: cover dictionary group keys with a shared values array#25198
LiaCastaneda wants to merge 1 commit into
apache:mainfrom
LiaCastaneda:bench/dict-group-values-shared-arc

Conversation

@LiaCastaneda

@LiaCastaneda LiaCastaneda commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Related to #24822. No issue closed.

Rationale for this change

The benchmarks in this file build a fresh values array per batch and cap cardinality at the batch size. Neither shape matches a real plan: take and filter clone the values Arc and rewrite only the keys, so batches downstream of a repartition share one values array, and because it is never compacted its cardinality can far exceed the rows in a batch. Per-batch work that scales with dictionary cardinality is invisible under the current parameters.

What changes are included in this PR?

Adds bench_shared_values_arc: 32 batches of 8192 rows sharing one values array, at cardinalities 8192, 100k and 500k.

What is the testing strategy for this PR?

Benchmark-only. Ran the bench locally and cargo clippy --all-targets -D warnings.

Are there any user-facing changes?

No

@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Sep 11, 2026
@LiaCastaneda
LiaCastaneda marked this pull request as ready for review September 11, 2026 15:19
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.91%. Comparing base (224cc56) to head (a824b90).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25198      +/-   ##
==========================================
- Coverage   81.91%   81.91%   -0.01%     
==========================================
  Files        1132     1132              
  Lines      421314   421314              
  Branches   421314   421314              
==========================================
- Hits       345135   345126       -9     
- Misses      55771    55779       +8     
- Partials    20408    20409       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@LiaCastaneda

LiaCastaneda commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Some results in my local machine with main against #25185 using these benchmarks

Benchmarking dict_shared_values_arc/shared_values_arc/size_8192_card_8192: Analyzing
dict_shared_values_arc/shared_values_arc/size_8192_card_8192
                        time:   [4.4547 ms 4.4614 ms 4.4687 ms]
                        thrpt:  [58.662 Melem/s 58.759 Melem/s 58.847 Melem/s]
                 change:
                        time:   [−3.0930% −2.6048% −2.1563%] (p = 0.00 < 0.05)
                        thrpt:  [+2.2038% +2.6745% +3.1918%]
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe

Benchmarking dict_shared_values_arc/shared_values_arc/size_8192_card_100000: Analyzing
dict_shared_values_arc/shared_values_arc/size_8192_card_100000
                        time:   [9.4512 ms 9.4870 ms 9.5291 ms]
                        thrpt:  [27.510 Melem/s 27.632 Melem/s 27.737 Melem/s]
                 change:
                        time:   [−24.007% −23.630% −23.219%] (p = 0.00 < 0.05)
                        thrpt:  [+30.240% +30.942% +31.592%]
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  5 (5.00%) high mild
  2 (2.00%) high severe

Benchmarking dict_shared_values_arc/shared_values_arc/size_8192_card_500000: Analyzing
dict_shared_values_arc/shared_values_arc/size_8192_card_500000
                        time:   [28.701 ms 28.850 ms 29.010 ms]
                        thrpt:  [9.0364 Melem/s 9.0865 Melem/s 9.1335 Melem/s]
                 change:
                        time:   [−33.820% −33.095% −32.356%] (p = 0.00 < 0.05)
                        thrpt:  [+47.833% +49.466% +51.102%]
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) low mild
  3 (3.00%) high mild
  2 (2.00%) high severe

summary:

| dictionary cardinality | D / rows | main     | with fix | speedup |
| ---------------------- | -------- | -------- | -------- | ------- |
| 8,192 (control)        | 1×       | 4.58 ms  | 4.46 ms  | 1.03×   |
| 100,000                | 12×      | 12.42 ms | 9.49 ms  | 1.31×   |
| 500,000                | 61×      | 43.12 ms | 28.85 ms | 1.49×   |

@Rich-T-kid Rich-T-kid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, left some non blocking comments


let mut group = c.benchmark_group("dict_shared_values_arc");
let size = SIZES[0];
let mut rng = StdRng::seed_from_u64(SEED);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we can re-use the seed at the top of the file

let size = SIZES[0];
let mut rng = StdRng::seed_from_u64(SEED);

for &cardinality in &[size, 100_000, 500_000] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit : I think the jump from 8k -> 100k is a bit steep. could we introduce 32k or 64k as an intermediate cardinality size?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants