Skip to content

perf: Optimize NULL handling in array_slice#21482

Open
neilconway wants to merge 1 commit intoapache:mainfrom
neilconway:neilc/perf-array-slice-nulls
Open

perf: Optimize NULL handling in array_slice#21482
neilconway wants to merge 1 commit intoapache:mainfrom
neilconway:neilc/perf-array-slice-nulls

Conversation

@neilconway
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

array_slice does a per-row NULL checking (in four different arrays!). It would be faster to take the union of the four input NULL buffers via NullBuffer::union.

Benchmarks (Arm64):

  - List(Int64), array args:                  60.98ms -> 58.35ms  (-4.3%)
  - List(Int64), array args, no stride:       28.19ms -> 25.92ms  (-8.0%)
  - List(Int64), scalar args, no stride:      57.07ms -> 55.56ms  (-2.6%)
  - List(Int64), scalar args, stride=-2:      99.44ms -> 96.05ms  (-3.4%)
  - List(Int64), scalar args, stride=-1:     155.23ms -> 155.30ms (+0.0%)
  - List(Int64), scalar args, stride=1:       58.50ms -> 55.91ms  (-4.4%)
  - List(Int64), scalar args, stride=2:      151.45ms -> 146.83ms (-3.1%)
  - ListView(Int64), array args:              56.19ms -> 52.86ms  (-5.9%)
  - ListView(Int64), array args, no stride:   28.53ms -> 24.35ms  (-14.7%)
  - ListView(Int64), scalar args, no stride:  58.65ms -> 58.34ms  (-0.5%)
  - ListView(Int64), scalar args, stride=-2:  93.85ms -> 91.59ms  (-2.4%)
  - ListView(Int64), scalar args, stride=-1: 149.68ms -> 149.06ms (-0.4%)
  - ListView(Int64), scalar args, stride=1:   59.53ms -> 58.90ms  (-1.1%)
  - ListView(Int64), scalar args, stride=2:  143.07ms -> 139.55ms (-2.5%)

What changes are included in this PR?

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@github-actions github-actions bot added the functions Changes to functions implementation label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize NULL handling in array_slice

1 participant