jhorstmann commented on issue #1400:
URL: https://github.com/apache/arrow-rs/issues/1400#issuecomment-1059762317


   Good point, I tried some other variations and it seems to come down to the 
handling of references vs copying. The following two variations lead to 
different code:
   
   ```
   pub fn min_reduce_ref(array: &[f64]) -> Option<f64> {
       array.iter().reduce(|a, b| if cmp(a, b) { b } else { a }).copied()
   }
   
   pub fn min_reduce_copied(array: &[f64]) -> Option<f64> {
       array.iter().copied().reduce(|a, b| if cmp(a, b) { b } else { a })
   }
   ```
   
   The second one generates the same code that I saw for `fold` earlier. In 
theory it should be possible that both get optimized to the same code and this 
might be limitation in LLVM.


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


Reply via email to