2 ms·
I am certain that one of the reasons Swift uses reference counting is to achieve more predictable performance and to avoid the GC pauses that plague Java etc.
by musicale 3y ago
I am certain that one of the reasons Swift uses reference counting is to achieve more predictable performance and to avoid the GC pauses that plague Java etc.
Another may be that it simplifies the runtime for system code such as kernels and device drivers.
- astrange 3y agoIt's not just that, reference counting is friendlier to non-uniform memory access, which is what you have on a system with swap and/or memory compression. In compacting GC, the compacting part can help here, but the GC part doesn't. But people do use GC on their phones, insofar as they like to use web browsers.
- pjmlp 3y agoSwift uses reference counting, because it interoperates with the Objective-C runtime, duh. .NET interop with COM is a good example of how mixing a tracing GC with a reference counted runtime requires an higher engineering budget that Swift team most likely wasn't willing to spend resources on. It has been proven multiple times that reference counting is slower and has performance issues when dealing with large graphs, and also stop-the-world issues when cascade deletions occur. If only pro-RC folks would bother to read CS papers and benchmarks.