Guest User

Untitled

a guest
Jan 17th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. use rayon::prelude::*;
  2.  
  3. fn sum_squares(input: &[i32]) -> i32 {
  4. input.iter()
  5. .map(|i| i * i)
  6. .sum()
  7. }
  8.  
  9. fn par_sum_squares(input: &[i32]) -> i32 {
  10. input.par_iter() // <-- just change that!
  11. .map(|i| i * i)
  12. .sum()
  13. }
Add Comment
Please, Sign In to add comment