News for hackers. Stuff that matters.
Re:Why has CPU frequency ceased to grow? (2014) by chrismorgan on Wednesday February 21, 2018 @05:48AM (#16428517)
A really powerful outworking of it is seen in the Rayon crate, where you can change a sequential iterator into a parallel iterator just by adding the crate, importing the trait and changing `iter` to `par_iter`. If it’s not thread-safe to do, then it won’t compile. (That’s the big difference from C++.) If it is, it will, and it’ll be smart about how it runs, spreading the load across all available cores pretty much optimally, or not bothering with multiple threads if it’s not going to be worth it (e.g. single-threaded, or only one item in the iterator). And all that with close enough to no overhead.

Basically, Rayon makes data parallelism really easy in a way that few if any other languages do. I’d love to have an equivalent in Python or Node, but it’s just not possible to achieve such a thing in most languages—even if you ignore the thread safety aspect.

Parallelism hasn’t seen a great deal of use until it’s urgently needed, because it’s hard to get right in most environments, and you normally need to substantially refactor code to make it happen. My hope is that with the likes of Rayon, parallelism can be a much more natural thing that people that care even a little about performance will just do, because it’s so easy to do.

https://crates.io/crates/rayon

Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @07:03AM (#16428803)
> Parallelism hasn’t seen a great deal of use until it’s urgently needed

This is the main reason why, initially, Windows Store APIs were all async.

Microsoft learned that when developers can choose between both models, by default most chose synch models.

Re:Why has CPU frequency ceased to grow? (2014) by romwell on Monday February 26, 2018 @10:47PM (#16470938)
>Basically, Rayon makes data parallelism really easy in a way that few if any other languages do.

Syntax-wise, there's OpenMP which can turn a for-loop into a parallelized for-loop (independently scheduled iterations) with just some syntactic sugar on top of the loop.

OpenMP has support for at least C++ and Fortran, and is not hard to use.

I wonder how Rayon compares to OpenMP.

Re:Why has CPU frequency ceased to grow? (2014) by ethagnawl on Wednesday February 21, 2018 @10:02AM (#16429893)
FWIW, you can also achieve similar behavior in Clojure via pmap, Reducers, etc.
Re:Why has CPU frequency ceased to grow? (2014) by floatboth on Wednesday February 21, 2018 @11:10AM (#16430460)
Re:Why has CPU frequency ceased to grow? (2014) by brazzy on Wednesday February 21, 2018 @11:57AM (#16430855)
To me, the "If it’s not thread-safe to do, then it won’t compile" part sounds rather more notable.
Re:Why has CPU frequency ceased to grow? (2014) by coolsunglasses on Wednesday February 21, 2018 @12:45PM (#16431307)
That's true of Haskell for the parallelism faculties. It's also true for STM. You can still get stuck or have race conditions with the other concurrency abstractions but it's less common than I encountered elsewhere. I didn't have problems resulting from mutable shared state that was aliased across threads and wasn't supposed to be, it's always explicit.
Re:Why has CPU frequency ceased to grow? (2014) by mitchtbaum on Wednesday February 21, 2018 @01:46PM (#16431833)
Another good crate to look at for this is Actix, Rust actors framework:

https://github.com/actix/actix