jhorstmann opened a new pull request, #4453:
URL: https://github.com/apache/arrow-rs/pull/4453
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
Closes #.
# Rationale for this change
I noticed an unexpected hotspot when profiling parquet benchmarks for
dictionary encoded arrays. The range checks that verify keys are in bounds take
a relatively large amount of time. There was already a comment suggesting to
use simd instructions, and in my opinion the compiler should have been able to
auto-vectorize the existing code, but it took some experimentation to get the
compiler generate more efficient code.
### Benchmark results compared to master branch on my laptop
(using rust 1.70, there was no change in generated code in earlier versions)
```
$ RUSTFLAGS="-Ctarget-cpu=skylake" cargo bench --features
arrow,test_common,experimental --bench arrow_reader -- --baseline master
StringDictionary
arrow_array_reader/StringDictionary/dictionary encoded, mandatory, no NULLs
time: [15.197 µs 15.334 µs 15.520 µs]
change: [-33.272% -32.922% -32.535%] (p = 0.00 <
0.05)
Performance has improved.
arrow_array_reader/StringDictionary/dictionary encoded, optional, no NULLs
time: [16.166 µs 16.213 µs 16.268 µs]
change: [-31.508% -31.347% -31.181%] (p = 0.00 <
0.05)
Performance has improved.
arrow_array_reader/StringDictionary/dictionary encoded, optional, half NULLs
time: [36.581 µs 36.735 µs 36.932 µs]
change: [-11.060% -10.605% -10.166%] (p = 0.00 <
0.05)
Performance has improved.
```
<!--
Why are you proposing this change? If this is already explained clearly in
the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your
changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
basically a one-line change
<!--
There is no need to duplicate the description in the issue here but it is
sometimes worth providing a summary of the individual changes in this PR.
-->
# Are there any user-facing changes?
no
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!---
If there are any breaking changes to public APIs, please add the `breaking
change` label.
-->
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]