How Does Swift Compare to Objective-C in Performance?

It may have come to your attention that there’s a new kid on the block when it comes to developing software for the Apple’s Mac OS X and iOS – Swift. With eerie resemblance of Javascript and a strong hint of C++, Swift may appear a little odd at first glance. Curiosity got the best of me, so I decided to put together a few simple, yet informative, test to see how Swift’s Javascript / C++ inspired syntax stacks up to Objective-C in the performance department.

CFArray vs NSArray Performance on iOS

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.