Hi all,
One thing @Richard Feldman and I talked about a bit ago was turning on atomic refcounts by default in the new compiler (would be configured by the platform header in the long term). This is the easiest way to allow for more complex use cases like multithreading and data sharing.
Modern CPUs are getting pretty fast at uncontested atomic refcounts. Still more costly than a normal refcount, but not by much. In a well written program, this likely will have minimal impact (we also have a few ideas to speed it up if it becomes a problem). Really the main foot gun is deeply recursive tags like cons lists (which already have horribly performance due to being a ton of pointer chasing).
In the name of starting simple and correct, atomics seem like the way to go.
For this thread, my core question is, should we enable atomic refcounts in the old compiler? It would enable some platform exploration. For example, adding background threads to basic webserver or basic CLI. It also, might give us an early signal if anyone notices a big perf drop.
I say go for it’
!
All atomic all the time PR: https://github.com/roc-lang/roc/pull/7718
Last updated: Jul 06 2025 at 12:14 UTC