They work just fine, but the problem comes with CAS contention. A atomic increment can take about 300 cycles on modern hardware and it flushes that cache line from some caches. With a RC system you’d end up doing a inc/dec on every read to every level of the persistent tree while you’re reading it. Rust supports this via the Arc reference type, but we’re still talking about a thousand cycles wasted just on bookkeeping while reading from a hashmap.
There are optimizations for all of this, but it’s true, the cost of persistent structures is much higher in a non GC context
6
u/vvvvalvalval Jun 11 '19
What's the strategy for memory management?