You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by "JasonLi-cn (via GitHub)" <gi...@apache.org> on 2024/04/21 08:21:48 UTC

Re: [PR] Optimization: make the most of Hint::AcceptsSingular when call make_scalar_function to Improve performance [datafusion]

JasonLi-cn commented on code in PR #10054:
URL: https://github.com/apache/datafusion/pull/10054#discussion_r1573668241


##########
datafusion/functions/src/string/overlay.rs:
##########
@@ -88,10 +105,13 @@ pub fn overlay<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {
             let characters_array = as_generic_string_array::<T>(&args[1])?;
             let pos_num = as_int64_array(&args[2])?;
 
+            let characters_array_iter = adaptive_array_iter(characters_array.iter());

Review Comment:
   Referring to the suggestions you provided, I attempted to make modifications, and according to the benchmark results, there is no significant change before and after optimization when the arg is an Array.
   However, I think the current implementation of the macro is not very good. Please help provide better suggestions for modification.
   
   ### New benchmark
   
   ```shell
   Gnuplot not found, using plotters backend
   4args_with_3scalars/overlay/1024
                           time:   [36.730 µs 36.969 µs 37.206 µs]
                           change: [-12.359% -11.851% -11.372%] (p = 0.00 < 0.05)
                           Performance has improved.
   Found 1 outliers among 100 measurements (1.00%)
     1 (1.00%) high mild
   
   4args_with_3scalars/overlay/4096
                           time:   [139.93 µs 140.35 µs 140.81 µs]
                           change: [-13.155% -12.784% -12.412%] (p = 0.00 < 0.05)
                           Performance has improved.
   Found 5 outliers among 100 measurements (5.00%)
     4 (4.00%) high mild
     1 (1.00%) high severe
   
   4args_with_3scalars/overlay/8192
                           time:   [284.61 µs 285.42 µs 286.43 µs]
                           change: [-12.164% -11.692% -11.219%] (p = 0.00 < 0.05)
                           Performance has improved.
   Found 1 outliers among 100 measurements (1.00%)
     1 (1.00%) high mild
   
   4args_without_scalar/overlay/1024
                           time:   [36.599 µs 36.683 µs 36.765 µs]
                           change: [-0.1637% +0.1015% +0.3769%] (p = 0.48 > 0.05)
                           No change in performance detected.
   Found 1 outliers among 100 measurements (1.00%)
     1 (1.00%) high mild
   
   4args_without_scalar/overlay/4096
                           time:   [142.05 µs 142.41 µs 142.84 µs]
                           change: [-1.5247% -1.2324% -0.9312%] (p = 0.00 < 0.05)
                           Change within noise threshold.
   Found 1 outliers among 100 measurements (1.00%)
     1 (1.00%) high severe
   
   4args_without_scalar/overlay/8192
                           time:   [291.79 µs 292.42 µs 293.19 µs]
                           change: [-2.9181% -1.9757% -1.1922%] (p = 0.00 < 0.05)
                           Performance has improved.
   Found 3 outliers among 100 measurements (3.00%)
     1 (1.00%) high mild
     2 (2.00%) high severe
   
   ```



-- 
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: commits-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org