Skip to content

bench(variant): add list-index lookup with empty lists - #11193

Merged
sdf-jkl merged 3 commits into
apache:mainfrom
emecii:bench/variant-list-validity-11052
Oct 2, 2026
Merged

sdf-jkl merged 3 commits into
apache:mainfrom
emecii:bench/variant-list-validity-11052

Conversation

@emecii

@emecii emecii commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Related to #11101 and #11052.

Rationale for this change

Add a small benchmark for variant_get list-index lookup when some rows are empty lists.

What changes are included in this PR?

Two benchmark functions in the existing variant_kernels target, following the nearby cases. The first builds 8,192 rows alternating empty and two-element integer lists, then looks up index zero with Variant output. The same fixture is timed unshredded and shredded as a List of Int64. Fixture construction, shredding, and path setup are outside timing; options cloning and output destruction are included.

The second restores the previously regressing small case: 64 one-element [1] lists shredded as List, index 9 (all out of bounds), and Int64 output. It checks that all 64 results are null before timing. The benchmark name is variant_get_list_index_all_oob_int64_64_rows.

Are these changes tested?

  • cargo bench --locked -p parquet-variant-compute --bench variant_kernels -- variant_get_list_index --test: all three cases pass.
  • Focused Criterion runs completed the mixed-list cases and the all-OOB case (50 samples, 1 s warm-up, 3 s measurement).
  • cargo test --locked -p parquet-variant-compute: 367 unit tests and 13 doc tests passed for the previous revision; this benchmark-only follow-up was validated with the benchmark smoke run, Criterion, Clippy, and formatting.
  • cargo clippy --locked -p parquet-variant-compute --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check, git diff --check, and the repository spelling check with typos 1.37.0 pass.

The benchmark runs on the existing baseline without asserting the missing-index validity behavior that #11052 fixes. Unshredded and shredded outputs currently differ in validity on empty rows, so these timings do not establish an equivalent-output speedup or the cost of that correctness fix. The earlier ~24% overhead observed in the separate 64-row all-OOB Int64 case remains unresolved; adding its benchmark does not change that result.

Are there any user-facing changes?

No. This only adds a benchmark; production code and dependencies are unchanged.

AI usage

OpenAI Codex generated this benchmark revision, ran the validation, and drafted this description and review reply.

@sdf-jkl

sdf-jkl commented Sep 28, 2026

Copy link
Copy Markdown
Member

Hi @emecii, I think the scope I agreed on in #11052 (comment) is way too big.

What we need here is to add a simple variant_get bench covering shredded list index lookup where some rows are empty lists. It can mimic the existing cases there

pub fn variant_get_bench(c: &mut Criterion) {

@emecii emecii changed the title bench(variant): measure shredded list-index validity bench(variant): add list-index lookup with empty lists Oct 1, 2026
@emecii

emecii commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Reduced this in a716195 to one function in variant_kernels.rs: 8,192 rows alternating empty and two-element lists, index-zero lookup, with unshredded and shredded timings. The matrix, separate target, allocation probe, and extra documentation are removed from the PR and preserved locally.

Both benchmark cases, 367 unit tests, 13 doc tests, Clippy, formatting, and spelling checks pass. The revised description records the measurement boundaries and known empty-row validity difference. This does not resolve the earlier ~24% overhead in the separate all-OOB Int64 case; #11052 is unchanged.

@sdf-jkl

sdf-jkl commented Oct 1, 2026

Copy link
Copy Markdown
Member

Thanks @emecii. Could you add the all-OOB Int64 case that showed a regression as well? Otherwise it's good

@emecii

emecii commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Added in 1855069: variant_get_list_index_all_oob_int64_64_rows uses 64 shredded [1] lists, index 9, and Int64 output—the earlier regressing case. All three benchmark smoke cases, Clippy, and formatting pass. The prior regression remains unresolved.

@sdf-jkl sdf-jkl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @emecii

@sdf-jkl
sdf-jkl added this pull request to the merge queue Oct 2, 2026
Merged via the queue into apache:main with commit f698c25 Oct 2, 2026
24 of 25 checks passed
@Jefffrey Jefffrey added the development-process Internal changes; PRs with this label are excluded from changelog label Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development-process Internal changes; PRs with this label are excluded from changelog parquet-variant parquet-variant* crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants