yordan-pavlov edited a comment on pull request #7798:
URL: https://github.com/apache/arrow/pull/7798#issuecomment-663888189
@jorgecarleitao thanks for the feedback
I did some more profiling specifically around the unsafe parts of the code
and found that the safe version of `copy_null_bit` is just as fast so have
removed that unsafe section; here are some benchmark results:
copy_null_bit unsafe:
filter context u8 w NULLs low selectivity time: [142.05 us 142.35 us
142.68 us]
filter context u8 w NULLs high selectivity time: [2.0915 us 2.1015 us
2.1127 us]
copy_null_bit safe:
filter context u8 w NULLs low selectivity time: [134.74 us 134.86 us
134.98 us]
filter context u8 w NULLs high selectivity time: [2.0536 us 2.0613 us
2.0707 us]
I also benchmarked replacing the unsafe section in the `filter_array_impl`
method with `value_buffer.write()` but this results in approximately 18% drop
in performance with sparse filter arrays as can be seen from the benchmark
results below:
filter u8 low selectivity
time: [131.08 us 132.46 us 134.27 us]
change: [+13.141% +17.189% +22.115%] (p = 0.00 <
0.05)
filter context u8 low selectivity
time: [127.47 us 129.27 us 131.56 us]
change: [+12.008% +19.674% +27.939%] (p = 0.00 <
0.05)
filter context u8 w NULLs low selectivity
time: [154.32 us 155.27 us 156.79 us]
change: [+15.444% +17.846% +22.268%] (p = 0.00 <
0.05)
filter context f32 low selectivity
time: [137.62 us 138.01 us 138.52 us]
change: [+12.495% +18.180% +23.088%] (p = 0.00 <
0.05)
finally, looking at the C++ implementation inspired me to change the
`filter_array_impl` method to add a special case where the 64bit filter batch
is all 1s and this doesn't appear to reduce performance in other cases but
improves performance of filtering with very dense filter arrays (almost all 1s)
by about 20 times; here are the latest benchmark results:
filter u8 low selectivity time: [118.21 us 118.82 us
119.61 us]
filter u8 high selectivity time: [4.9893 us 4.9941 us
4.9998 us]
filter u8 very low selectivity time: [11.861 us 11.919 us
11.987 us]
filter context u8 low selectivity time: [115.22 us 115.77 us
116.36 us]
filter context u8 high selectivity time: [1.6571 us 1.6784 us
1.7033 us]
filter context u8 very low selectivity time: [8.4205 us 8.4370 us
8.4590 us]
filter context u8 w NULLs low selectivity time: [132.49 us 132.78 us
133.10 us]
filter context u8 w NULLs high selectivity time: [2.1935 us 2.1979 us
2.2030 us]
filter context u8 w NULLs very low selectivity time: [161.64 us 162.12 us
162.55 us]
filter context f32 low selectivity time: [158.81 us 161.58 us
164.61 us]
filter context f32 high selectivity time: [1.8318 us 1.8371 us
1.8436 us]
filter context f32 very low selectivity time: [18.658 us 18.785 us
18.935 us]
@andygrove any thoughts?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]