3 ms·
I feel like using hybrid-rc [1] (biased reference counting [2]) instead of Arc should be more popular. You rarely need to send data between threads so when you
by vlovich123 3y ago
I feel like using hybrid-rc [1] (biased reference counting [2]) instead of Arc should be more popular. You rarely need to send data between threads so when you do you pay the atomic cost but otherwise you’re doing normal super fast arithmetic.
[1] https://docs.rs/hybrid-rc/latest/hybrid_rc/ https://docs.rs/hybrid-rc/latest/hybrid_rc/
[2] https://dl.acm.org/doi/10.1145/3243176.3243195 https://dl.acm.org/doi/10.1145/3243176.3243195
- kzrdude 3y agoThanks for the link. Biased reference counting is a topic I've heard of in Python now too (the Nogil discussions). However, HybridRc would still be as contended in the scenario in the blog post, wouldn't it (before the fix that solved it)? Just checking my understanding.
- vlovich123 3y agoThat’s a good question and I’m not sure but I think so? The unit and RuntimeContext would be sent once to each thread and Rune would take the RC variant everywhere and only upgrade to ARC when they actually need ‘Send (which you don’t use). It requires changes to Rune obviously but I think just converting Arc into HybridRc types.