Re:Immutable.rs: immutable data structures for Rust
by seeekr on Saturday April 07, 2018 @06:13AM
(#16780147)
So that means that the synchronization cost would only be paid when making a new copy of the Arc and releasing each of those. Ok, that extends the set of use cases where it's acceptable to use Arc then. Thanks for clarifying.
EDIT: wording
Re:Immutable.rs: immutable data structures for Rust
by masklinn on Saturday April 07, 2018 @08:04AM
(#16780374)
> So that means that the synchronization cost would only be paid when making a new copy of the Arc and releasing each of those.
Yes. An interesting note here is that due to Rust's ubiquitous use of references there will be little extraneous refcounting traffic unlike systems like e.g. Python where `a = b` might trigger a refcount increase. I think it was Armin Ronacher (mitsuhiko) who made that observation a few weeks back, possibly on twitter?
> I may be misunderstanding the implications of Arc and how it is implemented, and how it behaves in the absence of multiple threads
All Arc means is that refcounting operations use atomic increment/decrement instead of regular ones.