Skip to content

perf: optimize spark_size in spark-expr - #4877

Merged
mbutrovich merged 1 commit into
apache:mainfrom
andygrove:auto-opt/spark_size-2026-07-09-001
Jul 10, 2026
Merged

perf: optimize spark_size in spark-expr#4877
mbutrovich merged 1 commit into
apache:mainfrom
andygrove:auto-opt/spark_size-2026-07-09-001

Conversation

@andygrove

@andygrove andygrove commented Jul 9, 2026

Copy link
Copy Markdown
Member

⚠️ Autonomously generated by an LLM. This PR was created end-to-end by an automated agent with no human author. It has passed automated correctness (unit tests + differential fuzz) and micro-benchmark gates, but requires full human review. Do not merge without expert scrutiny.

What changed

Optimizes spark_size in the native spark-expr crate.

Compute list row sizes from the offset buffer instead of allocating a sliced ArrayRef per row via list_array.value(i), removing one heap allocation per row.

Evidence

  • Correctness: unit tests + seeded differential fuzz (bit-identical Arrow output vs main).
  • Benchmark (criterion, Rust-only): see numbers below; gate required ≥ 5.0% mean improvement with non-overlapping confidence intervals and no regressions.
spark_size_ list of short arrays: 93.333% faster (base 151223ns -> cand 10082ns)
spark_size_ list of long arrays: 94.086% faster (base 156323ns -> cand 9245ns)

@andygrove
andygrove marked this pull request as ready for review July 10, 2026 03:16

@mbutrovich mbutrovich 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! Thanks @andygrove!

@mbutrovich

Copy link
Copy Markdown
Contributor

One question though, I can't find all of the benchmarks in the PR description in the code. Were they temporary, hallucinated, or am I missing something?

@andygrove

Copy link
Copy Markdown
Member Author

One question though, I can't find all of the benchmarks in the PR description in the code. Were they temporary, hallucinated, or am I missing something?

Ah, this was from an earlier bug, now fixed, where benchmark results from different runs got mixed together. Let me re-verify this. Moving to draft.

@andygrove
andygrove marked this pull request as draft July 10, 2026 15:23
@andygrove
andygrove marked this pull request as ready for review July 10, 2026 15:23
@andygrove

Copy link
Copy Markdown
Member Author

One question though, I can't find all of the benchmarks in the PR description in the code. Were they temporary, hallucinated, or am I missing something?

Ah, this was from an earlier bug, now fixed, where benchmark results from different runs got mixed together. Let me re-verify this. Moving to draft.

Updated. It was listing additional benchmarks from a different PR. I updated the PR description to remove those ones.

@mbutrovich
mbutrovich merged commit edb7b65 into apache:main Jul 10, 2026
72 checks passed
@andygrove
andygrove deleted the auto-opt/spark_size-2026-07-09-001 branch August 5, 2026 19:57
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.

2 participants