andygrove opened a new pull request, #23542:
URL: https://github.com/apache/datafusion/pull/23542

   > 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
   
   Replaced the per-row chrono NaiveDateTime round trip in the untimezoned 
coarse path of date_trunc (week/month/quarter/year) with integer civil-calendar 
arithmetic, cutting several allocationless-but-validating chrono field setters 
down to a few integer ops per row.
   
   ## What changes are included in this PR?
   
   Replaced the per-row chrono NaiveDateTime round trip in the untimezoned 
coarse path of date_trunc (week/month/quarter/year) with integer civil-calendar 
arithmetic, cutting several allocationless-but-validating chrono field setters 
down to a few integer ops per row.
   
   ## Are these changes tested?
   
   Correctness: unit tests + seeded differential fuzz (bit-identical Arrow 
output vs `main`).
   
   Benchmark (criterion):
   
   - date_trunc_month_nanos_1000: 48.452% faster (base 19164ns -> cand 9878ns)
   - date_trunc_week_nanos_1000: 76.045% faster (base 23337ns -> cand 5590ns)
   - date_trunc_month_second_1000: 47.688% faster (base 17376ns -> cand 9090ns)
   - date_trunc_quarter_nanos_1000: 32.493% faster (base 22005ns -> cand 
14854ns)
   - date_trunc_year_nanos_1000: 39.449% faster (base 20460ns -> cand 12388ns)
   - date_trunc_minute_1000: 1.2% faster (base 654ns -> cand 647ns)
   
   Full criterion output:
   
   ```text
   date_trunc_minute_1000  time:   [645.50 ns 652.66 ns 659.52 ns]
                           change: [−2.0837% −1.1996% −0.2678%] (p = 0.01 < 
0.05)
                           Change within noise threshold.
   Found 3 outliers among 100 measurements (3.00%)
     3 (3.00%) high mild
   
   date_trunc_month_second_1000
                           time:   [9.0984 µs 9.1139 µs 9.1298 µs]
                           change: [−47.773% −47.688% −47.597%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 1 outliers among 100 measurements (1.00%)
     1 (1.00%) high severe
   
   date_trunc_week_nanos_1000
                           time:   [5.5882 µs 5.6103 µs 5.6308 µs]
                           change: [−76.154% −76.045% −75.951%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 2 outliers among 100 measurements (2.00%)
     2 (2.00%) low mild
   
   date_trunc_month_nanos_1000
                           time:   [9.8640 µs 9.8831 µs 9.9059 µs]
                           change: [−48.576% −48.452% −48.309%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 4 outliers among 100 measurements (4.00%)
     3 (3.00%) high mild
     1 (1.00%) high severe
   
   date_trunc_quarter_nanos_1000
                           time:   [14.849 µs 14.857 µs 14.869 µs]
                           change: [−32.666% −32.493% −32.339%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 16 outliers among 100 measurements (16.00%)
     1 (1.00%) low severe
     2 (2.00%) low mild
     7 (7.00%) high mild
     6 (6.00%) high severe
   
   date_trunc_year_nanos_1000
                           time:   [12.385 µs 12.391 µs 12.398 µs]
                           change: [−39.498% −39.449% −39.405%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 9 outliers among 100 measurements (9.00%)
     2 (2.00%) low mild
     4 (4.00%) high mild
     3 (3.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]

Reply via email to