3 ms·
As others have said it's a bit of a stretch to say Rust "encourages" it, but I'm also not sure it's accurate to call it "very costly". It has different costs th
by brundolf 4y ago
As others have said it's a bit of a stretch to say Rust "encourages" it, but I'm also not sure it's accurate to call it "very costly". It has different costs than mark and sweep, but Objective-C and Swift specifically use reference-counting because of its performance characteristics
- steveklabnik 4y agoAnd also in Rust you end up with less increment/decrement on the count, because you can safely borrow the interior without messing with the reference count. You really only need to mess with the count when an owner goes into or out of scope, not every reference. and you can use non-atomic counts if you’re not multithreaded, which is also cheaper.
- brundolf 4y agoTrue! I wonder how much of the GP's viewpoint came from an assumption that reference-counted pointers have to be pessimistic and always perform locking