Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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...


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.




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

Search: