andygrove opened a new pull request, #23593:
URL: https://github.com/apache/datafusion/pull/23593
> 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
Added an array fast path for trunc(value, scalar precision) that hoists
10^precision out of the per-element loop and uses a unary kernel instead of
broadcasting the precision and recomputing powi per element.
## What changes are included in this PR?
Added an array fast path for trunc(value, scalar precision) that hoists
10^precision out of the per-element loop and uses a unary kernel instead of
broadcasting the precision and recomputing powi per element.
## Are these changes tested?
Correctness: unit tests + seeded differential fuzz (bit-identical Arrow
output vs `main`).
Benchmark (criterion):
- trunc f32 precision array_ 1024: 87.531% faster (base 1284ns -> cand 160ns)
- trunc f64 precision array_ 1024: 81.29% faster (base 1313ns -> cand 245ns)
- trunc f32 precision array_ 4096: 91.021% faster (base 4542ns -> cand 407ns)
- trunc f64 precision array_ 4096: 82.983% faster (base 4560ns -> cand 776ns)
- trunc f32 precision array_ 8192: 92.235% faster (base 9475ns -> cand 735ns)
- trunc f64 precision array_ 8192: 81.919% faster (base 10319ns -> cand
1865ns)
Full criterion output:
```text
trunc f64 precision array: 1024
time: [245.17 ns 245.40 ns 245.70 ns]
change: [−81.321% −81.290% −81.259%] (p = 0.00 <
0.05)
Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
2 (2.00%) high mild
1 (1.00%) high severe
trunc f32 precision array: 1024
time: [159.81 ns 160.13 ns 160.65 ns]
change: [−87.558% −87.531% −87.495%] (p = 0.00 <
0.05)
Performance has improved.
Found 15 outliers among 100 measurements (15.00%)
6 (6.00%) high mild
9 (9.00%) high severe
trunc f64 precision array: 4096
time: [764.34 ns 768.58 ns 773.05 ns]
change: [−83.091% −82.983% −82.845%] (p = 0.00 <
0.05)
Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
2 (2.00%) high mild
6 (6.00%) high severe
trunc f32 precision array: 4096
time: [404.97 ns 405.35 ns 405.93 ns]
change: [−91.049% −91.021% −90.991%] (p = 0.00 <
0.05)
Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
2 (2.00%) high mild
11 (11.00%) high severe
trunc f64 precision array: 8192
time: [1.8676 µs 1.8741 µs 1.8813 µs]
change: [−81.960% −81.919% −81.874%] (p = 0.00 <
0.05)
Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
trunc f32 precision array: 8192
time: [729.32 ns 731.77 ns 734.41 ns]
change: [−92.264% −92.235% −92.203%] (p = 0.00 <
0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
6 (6.00%) high mild
```
## 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]