It's a library, so only half an answer to your question, but there's a fantastic library called rayon[1] created by one of the core contributors the the Rust language itself, Niko Matsakis. It lets you use Rust's iterator API to do extremely easy parallelism:
list.iter().map(<some_fn>)
becomes:
list.par_iter().map(<some_fn>)
Seeing as in the original example code, the final copies into the minifb have to be sequential due to the lock anyway, all the usage of synchronization primitives and in fact the whole loop could be replaced with something like:
let rendered = buffers.par_iter().map(<rendering>).collect();
for buffer in rendered.iter() {
// The copy from the article
}
I've not written much Rust in a while, so maybe the state of the art is different now, but there are a lot of ways to avoid having to reach specifically for synchronization primitives.
Really cool stuff. I don't like being negative when it comes to fantastic moves like this, but I'm still really disappointed that it doesn't support 64bit executables.
Or underground trains, or long tunnels, or hikes, or many things. Hopefully though the typical developer doesn't spend the majority of his time on an airplane. Me personally, I don't need to be coding so consistently that the loss of a few hours on a plane is going to stop me doing this.
Used to use a SoYouStart E5-1650v2 for the 6 Core/12 Hyper-Threads. I moved when I got a sweet server auction deal with two Xeon's but recently moved to Hetzner because the price for their AX50 Ryzen 1700X + 32GB of RAM is hard to beat.
I have been doing this for 4 years. I can rent a 16 core server for a couple of years for less cost than a low entry Macbook, with a 1Gbps line. With mosh, I can develop literally anywhere with no lag at all (or at least, no noticeable lag) even with a 3G connection. I can RDP to an EC2 Windows instance when I need a quick Windows machine, again with minimal lag even over 3G.
I sold my desktop, and now use a cheap £200 garbage laptop as a thin-client to my machine. Not only do I get incredible compile performance due to being able to use 16 core Xeon's, but I am not tied to any desktop.
I can whip out my phone and pop open a tmux session from anywhere, in an emergency I can hop onto a friends computer and thanks to SSH 2FA fearlessly login to my dev system with my full environment that I never have to close.
At this point, I would actively avoid jobs that wouldn't let me work this way. Currently got a sweet remote gig and I'm going to fly to Spain next week and spend a couple of weeks coding on the beach with my 3G tethered laptop.
Edit: Just to clarify, I don't need to work in an IDE or use any Windows software that I couldn't tunnel over X. So it might not work for everyone. Just wanted to give an example of it working out great for someone.
becomes:
Seeing as in the original example code, the final copies into the minifb have to be sequential due to the lock anyway, all the usage of synchronization primitives and in fact the whole loop could be replaced with something like:
I've not written much Rust in a while, so maybe the state of the art is different now, but there are a lot of ways to avoid having to reach specifically for synchronization primitives.