3 ms·
> Rust is a game changer in that it is built from the ground up to offer memory safety without garbage collection and still aims for zero overhead abstractions.
by hgs3 3y ago
> Rust is a game changer in that it is built from the ground up to offer memory safety without garbage collection and still aims for zero overhead abstractions.
Safe Rust cannot represent circular data structures which makes entire classes of algorithms and architectures unimplementable. You have to workaround these limitations by creating auxiliary structures for tracking references or use reference counting; neither are "zero overhead abstractions." Rust is only zero overhead if all you do is pass values up and down the call stack. Its false appeal says more about the simplistic types of applications folks are writing than anything else.
- jackmott42 3y agoOften the workaround to graph representations that safe Rust can't do with the usual pointer approach is faster. You keep the data in an array, which improves your cache hit rate. Even C++ programmers will often use the same workaround either for safety or performance reasons. As for overall performance in real programs, Rust seems to consistently do as well or better than C++ programs as the cases from Microsoft here show.
- dralley 3y ago> Safe Rust cannot represent circular data structures which makes entire classes of algorithms and architectures unimplementable In safe Rust. So just don't use safe Rust for those parts. Unsafe isn't evil, it's there for a reason. You should avoid it when possible and when there are no downsides, but sometimes there are, and that's ok.
- yazaddaruvala 3y agoThe font parsing code was ported to 100% safe rust (other than the C FFI), and was 10-15% faster to run than its Cpp predecessor. Make of that what you will.
- lozenge 3y agoThat's what they said. It aims for zero overhead abstractions.
- pkolaczk 3y ago> Safe Rust cannot represent circular data structures which makes entire classes of algorithms and architectures unimplementable. That's not accurate. Safe Rust can represent circular data structures. It cannot represent circular data structures with 0 overhead. But you can use Rc/Arc/Weak + RefCell for that and it is not very hard. Or use one of crates that expose ways of building self-referential structures in a safe way (of course they do use unsafe underneath, but the API is safe) like ouroboros.