Hacker News new | ask | show | jobs
by Rusky 857 days ago
Yes, Rust also makes it quite easy to minimize reference count bumps. Rc values are moved by default, which introduces no traffic, and increments are explicit calls to `clone`. You can have both optimizations together!

It's even possible to share an Rc-managed value across threads without switching to Arc, as long as the other thread(s) never needs to change the reference count and can be "scoped" (https://doc.rust-lang.org/stable/std/thread/fn.scope.html) to some lifetime that some particular Rc outlives.

1 comments

> Rc values are moved by default

That could similarly work for Arc values to minimize the atomic bumping.

Yes, Arc values are also moved by default. I was referring to both.