Not long ago, when Swift was still in its infancy beta stages, I decided to run the two languages through some test side-by-side and see how they compared against one another when it came to speed of execution. You can find the article here. Time has come and Swift is officially released along with iOS 8 and its time to revisit the performance comparison.
An application that I’m currently working requires making the drop to the CoreFoundation level so out of curiosity I decided to contrast and compare the performance difference associated with using the Foundation-level
NSArray object versus its CoreFoundation counterpart –
CFArray. To be more precise, in this test we are exploring the performance difference of iterating over the mutable version of both objects, inserting a string, getting the array count (to replicate a real-world scenario where the array size is not given) and retrieving the element at index. This is a brutally simple test, but will hopefully provide at least some insight into how fast each method really is in comparison.