fn sum_of_squares(input: &[i32]) -> i32 { input.iter() .map(|&i| i * i) .sum() }
If you changed it to input.par_iter() then it executes in parallel on multiple threads.
fn sum_of_squares(input: &[i32]) -> i32 { input.iter() .map(|&i| i * i) .sum() }
If you changed it to input.par_iter() then it executes in parallel on multiple threads.