What Apple’s Swift Language Could Mean For Mobile App Performance

Apple’s announcements at WWDC 2014 this week have potentially significant implications for performance in iOS apps. Most notably through the launch of Swift, an entirely new programming language that has been optimized for speed, efficiency, and security.

Before entering into debate about whether or not Swift is in fact a higher performance language, it’s important to take stock of what that actually means. In most cases, a high-level language like Objective-C or Swift comes with baggage due to many levels of abstraction. These levels of abstraction are what help programmers solve bigger, more complex problems with less effort. But it also means that these highly abstracted languages can’t always compete with the efficiencies of a lower-level language like C.

SWIFT

When we evaluate programming languages for benchmarking, there are really two ways to look at performance:

  1. the performance of the code that is produced by the language,  and
  2. the amount of developer time and effort required to actually write and debug solutions.

The introduction of Swift seems to be a clear leap forward for the latter, as the language has been re-imagined to be more accessible, flexible, and readable. As Apple describes it, “the compiler is optimized for performance, and the language is optimized for development, without compromising on either.” Seemingly a mashup of a number of different modern languages like Rust, Haskell, Ruby, Python, and C#, the code has a sort of familiarity that can’t be found in Objective-C. Also, in comparison to Objective-C, it has been designed such that developers can theoretically write less but achieve more.

Evaluating the efficiency of the code produced by a language, and thus the performance of the language itself, is more complicated. The execution time of code is closely dependent upon a number of different factors including the actual algorithms used, and the context. There will always be speed and efficiency tradeoffs as certain languages will demonstrate superior performance in specific contexts they were optimized to handle. Apple holds an advantage over other mobile platforms due to its ability to closely couple the OS and hardware efficiencies, optimizing for performance on both fronts.

So far, the statistics that Apple released suggest that complex object sorts in Swift are nearly four times faster than Python. This is just the first of many performance benchmarks to be evaluated in the coming weeks and months. The real question is: Will iOS and Mac apps written with Swift see an overall performance improvement compared to Objective-C apps and other development platforms? We’ll be closely monitoring the millions of data points we collect using our mobile app performance monitoring solution, New Relic Mobile, to see how this plays out. Stay tuned.

Brittany is the Mobile Product Manager at New Relic, an application performance management company. She is passionate about helping developers everywhere achieve optimal performance in their mobile applications. Previously, Brittany was co-founder and CEO of FadingRed, a Mac/iOS app development shop where she also actively coded. Formerly the co-leader of Girl Develop It Chicago, Brittany is passionate about working to change the ratio in tech. View posts by .

Interested in writing for New Relic Blog? Send us a pitch!