www.reddit.com/r/rust/comments/102cdmg/synccow_a_threadsafe_cloneonwrite_container_for/
I was looking for a container like this when working on another project and didn't find any. So I implemented it myself:
https://crates.io/crates/sync_cow It's like RwLock, as you can share it between threads and read and write safely, but faster in certain circumstances. The difference is that 'read' operations are never blocked and will return instantly, while write operations are only blocked by other write operations. In other words: you can read and write at the same time. This is especially helpful in a performance-critical context where a value is often read by many threads and seldom updated. The disadvantages are a higher memory footprint, as the container stores at least two copies of the data (and more for every reader that still reads old data) and for large data structures the clone-on-write operation will nullify performance benefits (but the readers will still be super fast). I think I could reduce the memory overhead by using Weak pointers for th
--
FROM 117.147.20.*