andygrove opened a new pull request, #23546:
URL: https://github.com/apache/datafusion/pull/23546
> This PR was created by an LLM as a draft PR. I will mark it as ready for
review after human review.
## Which issue does this PR close?
N/A — autonomous exploratory PR.
## Rationale for this change
Hoist the scalar base's natural logarithm out of the per-row loop in
log(base, x), since f64::log(base) is ln(x)/ln(base) and recomputed ln(base) on
every row, halving the transcendental calls with bit-identical results.
## What changes are included in this PR?
Hoist the scalar base's natural logarithm out of the per-row loop in
log(base, x), since f64::log(base) is ln(x)/ln(base) and recomputed ln(base) on
every row, halving the transcendental calls with bit-identical results.
## Are these changes tested?
Correctness: unit tests + seeded differential fuzz (bit-identical Arrow
output vs `main`).
Benchmark (criterion):
- log_f64_array_base: 3.204% faster (base 37537ns -> cand 36335ns)
- log_f32_scalar_base: -0.358% faster (base 13815ns -> cand 13865ns)
- log_f64_default_base: 6.02% faster (base 18314ns -> cand 17211ns)
- log_f32_array_base: -0.329% faster (base 24782ns -> cand 24863ns)
- log_f64_scalar_base: 6.153% faster (base 18284ns -> cand 17159ns)
Full criterion output:
```text
log_f64_default_base time: [17.193 µs 17.203 µs 17.220 µs]
change: [−6.1581% −6.0197% −5.9020%] (p = 0.00 <
0.05)
Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
2 (2.00%) high mild
2 (2.00%) high severe
log_f64_scalar_base time: [17.140 µs 17.146 µs 17.152 µs]
change: [−6.2343% −6.1533% −6.0954%] (p = 0.00 <
0.05)
Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high severe
log_f32_scalar_base time: [13.859 µs 13.867 µs 13.877 µs]
change: [+0.2720% +0.3581% +0.4457%] (p = 0.00 <
0.05)
Change within noise threshold.
Found 8 outliers among 100 measurements (8.00%)
1 (1.00%) low mild
3 (3.00%) high mild
4 (4.00%) high severe
log_f64_array_base time: [36.240 µs 36.363 µs 36.489 µs]
change: [−3.3640% −3.2036% −3.0253%] (p = 0.00 <
0.05)
Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
10 (10.00%) high mild
log_f32_array_base time: [24.855 µs 24.868 µs 24.892 µs]
change: [+0.2349% +0.3285% +0.4056%] (p = 0.00 <
0.05)
Change within noise threshold.
Found 9 outliers among 100 measurements (9.00%)
2 (2.00%) low mild
3 (3.00%) high mild
4 (4.00%) high severe
```
## Are there any user-facing changes?
<!--
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]