2 ms·
Rust's Rayon library is pretty good for these use-cases https://github.com/rayon-rs/rayon https://github.com/rayon-rs/rayon use rayon::prelude::*; fn s
by nicoburns 6y ago
Rust's Rayon library is pretty good for these use-cases https://github.com/rayon-rs/rayon https://github.com/rayon-rs/rayon
use rayon::prelude::*;
fn sum_of_squares(input: &[i32]) -> i32 {
input.par_iter() // <-- just change that!
.map(|&i| i * i)
.sum()
}