Do the advantages of Rust begin to disappear when you start writing complex parallel code?

152 points RylanStylin57

I've been using Rust for about 3 years, I'm a college student studying HPC in research.

When I implemented an ECS in Rust, I found that there was no "safe" way of doing it. I had to construct a data dependency graph when the program started and use that to decide which systems could run in parallel. This works, but its a maelstrom of unsafe code. Implementing it with RwLocks and Mutexes would be \unbearably\ slow (since I'd have to put a lock over every component vector in every archetype) and would probably cause deadlock. With the graph solution, I was able to ensure there would be no conflicts and remove all smart pointer overhead.

I'm implementing a graph data structure for backpropogation (for machine learning) on a computational graph, and I'm having alot of trouble with making the compiler happy with perfectly safe code. It seems like, one again, I'm going to have to raw pointer it into oblivion.

When working with these more complex parallel applications, I find that unsafe code is just better, especially when we can make guarantees about safety without necessarily having to smart pointer it.