Re:Swift System Is Now Open Source
by NobodyNada on Saturday September 26, 2020 @12:37AM
(#24596451)
Swift already uses reference counting for memory management, so copy-on-write is basically free -- it just checks to see if the collection's reference count is greater than 1 before writing.
[ Parent
| on HN ]
It's decidedly not free. Reference counting in Swift can be (is?) a major bottleneck. See this project: https://github.com/ixy-languages/ixy-languages and its discussion on Swift performance: https://github.com/ixy-languages/ixy.swift/blob/master/perfo...
Re:Swift System Is Now Open Source
by NobodyNada on Saturday September 26, 2020 @12:06PM
(#24599791)
It’s free since the language is already using reference counting. But yes, retain/release traffic is often a huge problem in performance-critical code.