I wrote a #Rust script that is, as expected, taking some time and CPU resources. However I see that it's only using one of my 8 cores(?) (see screenshot).
If I were to use threads in Rust could I use more than one CPU? https://octodon.social/media/YxBLdEj5e0Qg6PcNu5U
@mathuin right, yeah, for sure I knew I'd need to implement something code-wise. Just wanted to make sure Rust threads would be able to use more than one of my cores.
and re-wrapper, @carey sent me link to : https://github.com/rayon-rs/rayon
Haven't tried it yet though, but it looks really lightweight
right -- my issue is that I wrote my big loop as a `for` loop (like `for word in word_list { do things }`). Can I just do
word_list.par_iter( |word|
do things
)
my code: https://github.com/sts10/half-entropy-word-checker/blob/master/src/main.rs#L46
@schlink @carey Yeah that's what I was actually looking for. I believe it's pretty efficient, I mean that's one of rust's main goals, zero-cost abstractions.