2010YOUY01 opened a new pull request, #12078:
URL: https://github.com/apache/datafusion/pull/12078

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   
   NA
   
   ## Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in 
the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your 
changes and offer better suggestions for fixes.  
   -->
   (The change has 2 lines)
   
   Before `random()` scalar function's implementation use `rand` crate to 
generate random values one by one
   And `rand` crate suggests using another method for efficiency, if it's 
intended to generate an array of random values.
   https://docs.rs/rand/latest/rand/trait.Rng.html#arrays-and-tuples
   
   I tried and get 20% speedup in micro bench (evaluate 1M rows with 8k batch 
size)
   ```
       Finished `bench` profile [optimized] target(s) in 1m 41s
        Running benches/random.rs 
(/Users/yongting/Desktop/code/my_datafusion/arrow-datafusion/target/release/deps/random-b9fac37452f14654)
   random_1M_rows_batch_8192
                           time:   [3.4447 ms 3.4721 ms 3.5062 ms]
                           change: [-25.835% -24.272% -22.846%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 6 outliers among 100 measurements (6.00%)
     2 (2.00%) high mild
     4 (4.00%) high severe
   
   random_1M_rows_batch_128
                           time:   [5.6501 ms 5.7283 ms 5.8324 ms]
                           change: [-4.2195% -2.8815% -1.1987%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 11 outliers among 100 measurements (11.00%)
     5 (5.00%) high mild
     6 (6.00%) high severe
   ```
   
   ## What changes are included in this PR?
   
   change function body + micro bench
   <!--
   There is no need to duplicate the description in the issue here but it is 
sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ## Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are 
they covered by existing tests)?
   -->
   By existing tests
   
   ## Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   No
   <!--
   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