3 ms·
It should be easy to construct Swift code that is much than its ObjC equivalent by failing to account for copy-on-write: https://medium.com/folded-plane/swift-
by gurkendoktor 9y ago
It should be easy to construct Swift code that is much than its ObjC equivalent by failing to account for copy-on-write:
https://medium.com/folded-plane/swift-array-appending-and-avoiding-o-n-6082619cdf7b https://medium.com/folded-plane/swift-array-appending-and-av...
So Swift is faster than ObjC by a constant factor, until you run into this subtle issue (which didn't really exist in ObjC), and then it's suddenly slower by a full O(n). Whether that's a good trade-off depends on how good of a language lawyer you are. It's C vs C++ all over again...
- mpweiher 9y agoThere are many cases like that. How was that with protocol generics and collections? When can it remove ARC calls? > It's C vs C++ all over again... From a performance POV, it seems to be a lot worse than C++. Much less baseline performance, less predictability, and almost no way to get to peak performance.