simonvandel opened a new pull request, #12881:
URL: https://github.com/apache/datafusion/pull/12881
## 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.
-->
Didn't create an issue beforehand.
## Rationale for this change
<!--
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.
-->
`iszero` runs faster using `BooleanArray::from_unary`.
I think this is because we don't need to branch on each value to check if
it's null, which the `.iter` inside `make_function_scalar_inputs_return_type`
is doing.
## What changes are included in this PR?
<!--
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.
-->
- Add benchmark
- Replace `make_function_scalar_inputs_return_type` use with
`BooleanArray::from_unary`
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are
they covered by existing tests)?
-->
Yes, with existing tests.
## Are there any user-facing changes?
Faster `iszero`. I don't expect this function to be a bottleneck anywhere,
but at least it's a bit faster now.
```
iszero f32 array: 1024 time: [771.48 ns 773.07 ns 774.97 ns]
change: [-69.960% -69.618% -69.232%] (p = 0.00 <
0.05)
Performance has improved.
Found 16 outliers among 100 measurements (16.00%)
6 (6.00%) high mild
10 (10.00%) high severe
iszero f64 array: 1024 time: [683.35 ns 683.91 ns 684.49 ns]
change: [-71.834% -71.698% -71.596%] (p = 0.00 <
0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
2 (2.00%) high mild
4 (4.00%) high severe
iszero f32 array: 4096 time: [2.6036 µs 2.6096 µs 2.6169 µs]
change: [-76.842% -76.730% -76.618%] (p = 0.00 <
0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
1 (1.00%) low mild
1 (1.00%) high mild
4 (4.00%) high severe
iszero f64 array: 4096 time: [2.2268 µs 2.2291 µs 2.2316 µs]
change: [-80.502% -80.449% -80.397%] (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
iszero f32 array: 8192 time: [5.0282 µs 5.0438 µs 5.0620 µs]
change: [-79.426% -79.363% -79.282%] (p = 0.00 <
0.05)
Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
1 (1.00%) low mild
4 (4.00%) high mild
6 (6.00%) high severe
iszero f64 array: 8192 time: [4.2459 µs 4.2543 µs 4.2643 µs]
change: [-82.480% -82.445% -82.411%] (p = 0.00 <
0.05)
Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) high mild
1 (1.00%) high severe
```
<!--
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 `api
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]