Hacker News new | ask | show | jobs
by asendra 4334 days ago
Well, It is a comparison between Objective-C and Swift, after all. He is using the proper data structures in each language for this tests. It's true is not the most efficient way to go about it in an Objective-C app, because you can mix it with C and C++, but then you wouldn't be using Objective-C, and the title of the article probably wouldn't be "An analysis of sorts between Objective-C and Swift".
1 comments

(See above response). Sure for C++, but certainly not C. When you use a double in Objective-C its not "no longer Objective-C and actually C now". C is a part of Objective-C. Not using c-style arrays is an arbitrary limitation, and forcing one to not use the proper data structures. No one recommends using an NSMutableArray for gigabytes of ints, it is well established that it is not the proper data structure for that. That being said, I totally agree that it is better in Swift. My point is simply that the demonstration should be one of the impressive ease of use/performance tradeoff vs. a questionable raw speed comparison where you don't actually see how fast it would go in a shipping Objective-C program that used every available tool at its disposal.

In other words, this blog post could be misinterpreted to give the impression that apps will now necessarily get faster thanks to Swift. But this is certainly not true if the C version is 1) faster and 2) in wide use. Instead the argument should be apps will be more reliable at negligible speed loss, and possibly even faster (again we don't know since that benchmark wasn't done).