Commit e9bcfb4
authored
perf: Optimize compare_element_to_list (#20323)
## Which issue does this PR close?
- Closes #20322
## Rationale for this change
`compare_element_to_list` is a utility function used by several of the
array-related UDFs (e.g., array_position, array_positions, array_remove,
and array_replace).
The current implementation extracts a scalar from an array using
`arrow::compute::take()`. This is slow; we can just use `slice`
directly, which also avoids allocating an intermediate array of indices.
## What changes are included in this PR?
## Are these changes tested?
Yes; microbenchmarks indicate 15-50% performance improvement for
`array_remove`.
## Are there any user-facing changes?
No.1 parent f5a2ac3 commit e9bcfb4
2 files changed
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | 167 | | |
169 | 168 | | |
170 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
165 | | - | |
| 164 | + | |
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
| |||
0 commit comments