3 ms·
Rust also uses refcounting, not tracing GC. The problem with Swift is its use of obligate GC for things that don't need it in other languages (C/C++, Rust).
by zozbot123 8y ago
Rust also uses refcounting, not tracing GC. The problem with Swift is its use of obligate GC for things that don't need it in other languages (C/C++, Rust).
- pjmlp 8y agoRust doesn't do refcounting, it makes use of an affine type system, which is something completly different. If you make use of the refcounting library types in Rust, from the std::rc and std::sync crates, the performace impact would be quite similar.
- zozbot123 8y agoSure, but you don't need refcounting for cases that are covered by Rust's affine types, even in C/C++. You can use the patterns described in the C++ Core Guidelines, and end up with something quite rusty, only without fully-automated checking. (Besides, I think std::rc has better performance than the refcounts found in Swift and C++, because it's used in cases that don't need atomic update, and yes this is statically checked too.)
- pjmlp 8y ago> You can use the patterns described in the C++ Core Guidelines, and end up with something quite rusty, only without fully-automated checking. Also known as the mythical "only other programmers commit errors, I am always correct".
- asdkhadsj 8y agoYea, I'm not sure what point was being made there. Rust isn't about being faster than C, it's about not letting you make mistakes you can make in C/etc. If you could somehow write perfect code in a timely manner, you'd have no need for Rust. You'd likely also be a unicorn.
- steveklabnik 8y agoYou also only need to bump the counts on Rc<T>/Arc<T> for each owner, not for every reference, which reduces refcount traffic.
- mmirate3 8y ago> only without fully-automated checking The fully-automated checking is precisely what allows one to write unmanaged code without tearing one's hair out.