Hacker News new | past | comments | ask | show | jobs | submit login

What is the role of ARC (automatic reference counting such as in swift) compared to the explicit approaches rust takes?



I found a paper with survey about the reference counting overhead of the Swift language. It says on popular client side benchmarks, the atomic counter update itself takes 42% of the total execution time on average.

Keep in mind that in swift virtually everything is Arc-ed, so it puts heavy optimization on it like merging several counter updates within a scope into single atomic operation.

In my opinion such a performance cost is absolutely worth it in most applications given the much reduced complexity when writing code.


It's really not. ARCing everything gives you less efficient code than just using tracing garbage collection. The approach that makes RC and ARC worthwhile is the one seen in Rust, where RC is only used for any object that might have more than a single "owner" controlling its lifecycle, and ARC when such "ownership" might be shared across threads.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: