You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make array_reverse faster for List and FixedSizeList (#18500)
## Rationale for this change
Noticed while doing #18424 that the list types `List` and
`FixedSizeList` uses `MutableData` to build the reverse array. Using
`take` turns out to be a lot faster, ~70% for both `List` and
`FixedSizeList`. This PR also reworks the benchmark added in #18425, and
these are the results on that compared to the implementation on main:
```
# cargo bench --bench array_reverse
Compiling datafusion-functions-nested v50.3.0 (/Users/vegard/dev/datafusion/datafusion/functions-nested)
Finished `bench` profile [optimized] target(s) in 42.08s
Running benches/array_reverse.rs (target/release/deps/array_reverse-2c473eed34a53d0a)
Gnuplot not found, using plotters backend
Benchmarking array_reverse_list: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.3s, or reduce sample count to 70.
array_reverse_list time: [62.201 ms 62.551 ms 62.946 ms]
change: [−70.137% −69.965% −69.785%] (p = 0.00 < 0.05)
Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
5 (5.00%) high mild
3 (3.00%) high severe
Benchmarking array_reverse_list_view: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.3s, or reduce sample count to 70.
array_reverse_list_view time: [61.649 ms 61.905 ms 62.185 ms]
change: [−16.122% −15.623% −15.087%] (p = 0.00 < 0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
5 (5.00%) high mild
1 (1.00%) high severe
array_reverse_fixed_size_list
time: [4.7936 ms 4.8292 ms 4.8741 ms]
change: [−76.435% −76.196% −75.951%] (p = 0.00 < 0.05)
Performance has improved.
Found 20 outliers among 100 measurements (20.00%)
8 (8.00%) low mild
5 (5.00%) high mild
7 (7.00%) high severe
```
## Are these changes tested?
Covered by existing sqllogic tests, and one new test for
`FixedSizeList`.
0 commit comments