Re:Swift is a lot like Scala
by pjmlp on Sunday August 24, 2014 @11:20AM
(#8218759)
Because they care about performance in multi-core contexts.
[ Parent
| on HN ]
Reference counting and multi-core performance are not mutually exclusive at all. In a lot of applications where you exploit parallelism, you parallelise loops (e.g. via OpenMP), usually objects go out of scope outside the parallelized loop (single threaded code), so you can use a bare pointer. In the loop you do mostly stack allocations.
Of course, there are degenerate cases where there's a lot of lock contention on the reference count. However, there are degenerate cases in most garbage collectors for multi-core as well. Isn't Go still using a stop-the-world GC?
Edit: I wanted to add that I am not against garbage collectors. You lose deterministic destructors, but a well-developed garbage collector like the JVM's is very performant in most situations, and in many cases indeed more performant than reference counting.
Then what languages or virtual machines uses reference counting and is performant in a muti-core context?
:-)