seddonm1 opened a new pull request #8943:
URL: https://github.com/apache/arrow/pull/8943


   After adding benchmarking capability to the UTF8 to Date32/Date64 CAST 
functions there was opportunity to improve the performance.
   
   This PR uses inbuilt `chrono` functionality to calculate the number of days 
since CE then uses a constant to calculate the offset days relative to 
1970-01-01. This improves performance around 10% for this operation relative to 
the `since` function presumably as `chrono` does not have to ensure the 
`from_ymd` is a valid date.
   
   Before:
   ```
   cast utf8 to date32 512 time:   [41.966 us 42.508 us 43.087 us]
   cast utf8 to date32 512 time:   [40.591 us 40.661 us 40.740 us]
   cast utf8 to date32 512 time:   [40.825 us 40.878 us 40.916 us]
   ```
   
   After:
   ```
   cast utf8 to date32 512 time:   [36.557 us 36.839 us 37.200 us]
   cast utf8 to date32 512 time:   [35.997 us 36.442 us 36.919 us]
   cast utf8 to date32 512 time:   [35.750 us 35.969 us 36.160 us]
   ```


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to