Performance in iOS and WatchOS
At the developers conference, Apple starts off strong regarding the performance of iOS apps and dives a little bit deeper into the native WatchOS app world that will soon be released for public consumption. Apple considers performance in iOS and WatchOS to be a feature that should be considered throughout the entire app development process. Apps that are designed for high performance will also increase the responsiveness of the app increasing customer interest. Now that iOS supports multitasking on the iPad performance becomes even more important as two apps can now use a larger number of resources and thus a poorly performing app can actually conflict with the function of other apps being used with multitasking.
Now that you understand what Apple thinks of performance how do you implement it? It is recommended to take measurements and taking the time to fully review the performance of your app before its release. Using the right tool for the job is inherently important. Apple suggests using their APIs and frameworks, this allows your app to pass off tasks to APIs of the device, one reason for doing this is that when iOS releases updates affecting their API users will gain the benefit of those updates without you having to manually add the updated functionality and releasing an update.
Apple suggests that you measure performance in the categories of
- Animations
- Core Animation
- Responsiveness
- Simply instrument your code
- System trace tools can help
- Memory
- Debug in Xcode
- Allocations
- Leaks
Apple selects specific performance goals, for example keeping responses to user actions to around 100ms, refraining from trying to optimize the performance of code that you have yet to test and of course ensure you only make a single change at a time. Taking the time to follow a performance workflow will help you ensure that you locate performance issues in your code and properly resolve them without causing a bigger problem. Apple uses a simple workflow of Reproduce, Profile, Measure, Update code and repeat as needed.
The main thread of your app will consume the most user input such as touching and scrolling, orientation, multitasking resizes, etc. Keeping your main thread optimized will ensure a great user experience with responsiveness users expect. Avoid overusing your cpu resources as these will quickly consume your processor’s available cycles causing severe slowdowns in your app.
When developing your app the amount of memory your app utilizes is vastly important as all iOS devices have a hard limit of memory available, while it is possible for iOS to clear out applications that are using memory to reallocate it to your app this process takes time and will vastly slow down the responsiveness of your app.
Native code on WatchOS is now available to many developers however there are some significant chances which were made to ensure the highest performance. You should focus on limiting the amount of server logic whenever possible. Keeping your network traffic to a minimum will prevent using un-necessary resources while users are not actively requesting new information from an app.