Re:How Rust optimizes async/await
by nemothekid on Monday August 19, 2019 @09:27PM
(#20743134)
Is shared_ptr a zero cost abstraction?
[ Parent
| on HN ]
Mostly, with the caveat that in single threaded usage, you're paying for the unnecessary overhead of atomic ops on the reference count.
Rust has `Rc`, which is not atomic but `!Send` so the type system ensures that it stays within a thread, as well as the atomic `Arc`.