4 ms·
Reference counting doesn't have the same cost as a sweeping garbage collector. Apple has also optimized their custom ARM core to further reduce the cost. > re
by GeekyBear 2y ago
Reference counting doesn't have the same cost as a sweeping garbage collector.
Apple has also optimized their custom ARM core to further reduce the cost.
> retaining and releasing an NSObject takes ~30 nanoseconds on current gen Intel, and ~6.5 nanoseconds on an M1
https://blog.metaobject.com/2020/11/m1-memory-and-performance.html?m=1 https://blog.metaobject.com/2020/11/m1-memory-and-performanc...
That said, Swift is working toward adding a future opt-in Rust inspired approache to memory management for those who need it.
https://forums.swift.org/t/manifesto-ownership/5212 https://forums.swift.org/t/manifesto-ownership/5212
https://forums.swift.org/t/a-roadmap-for-improving-swift-performance-predictability-arc-improvements-and-ownership-control/54206 https://forums.swift.org/t/a-roadmap-for-improving-swift-per...