I love the Atomic ARC. Initially, I entertained the idea of having both a ref 
and thread-safe atomic ref. However, upon further reflection, I don't reckon 
it's a good idea. Numerous refs come from libraries that you can't edit. Sure, 
refs can influence one another, such as all refs of an atomic ref atomic as 
well - the "ref coloring problem". But what if you set an atomic to a local 
ref? Does that make it atomic too? It's overly convoluted and not worthwhile.

The solution is to use a simple arc for single threads, and when --threads:on 
is enabled, it should use atomic refs. The negligible speed loss is 
inconsequential. Look, I'm all about speed, but when you're optimizing for 
speed, you shift to using non ref objects, UnsafeArrays and pointers. Refs 
should be about convenience.

I feel Nim does not have a good solution for threading right now. My CPU has 32 
cores! I think Atomic ARC is one step closer to making Nim be really good at 
threads.

Reply via email to