|
|
|
|
|
by hamandcheese
480 days ago
|
|
> Never check strong_count to see if you are "the last owner". This made me think of the `im` library[0] which provides some immutable/copy on write collections. The docs make it seem like they do some optimizations when they determine there is only one owner: > Most crucially, if you never clone the data structure, the data inside it is also never cloned, and in this case it acts just like a mutable data structure, with minimal performance differences (but still non-zero, as we still have to check for shared nodes). I hope this isn't prone to a similar race condition! [0] https://docs.rs/im/15.1.0/im/index.html |
|