Hacker News new | ask | show | jobs
by gurkendoktor 3114 days 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-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...

1 comments

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