4 ms·
> - Collections are value types (implemented somewhat efficiently by having copy-on-write collections) Isn't copy on write data structures mostly discouraged i
by higerordermap 6y ago
> - Collections are value types (implemented somewhat efficiently by having copy-on-write collections)
Isn't copy on write data structures mostly discouraged idea these days?
- NobodyNada 6y agoSwift 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.
- dmitriid 6y agoIt's decidedly not free. Reference counting in Swift can be (is?) a major bottleneck. See this project: https://github.com/ixy-languages/ixy-languages https://github.com/ixy-languages/ixy-languages and its discussion on Swift performance: https://github.com/ixy-languages/ixy.swift/blob/master/performance/README.md https://github.com/ixy-languages/ixy.swift/blob/master/perfo...
- NobodyNada 6y agoIt’s free since the language is already using reference counting. But yes, retain/release traffic is often a huge problem in performance-critical code.