Last time we discussed some of the tips Apple gave at the recent iOS5 Tech Tour stop in Beijing on how to get your app noticed in the App Store.
Naturally, there were also plenty of informative technical sessions that touched on just about any part of the API you might be interested in, but one that really stood out was the “Performance Hitlist” talk.
Here are some of the key points Apple mentioned that you may want to consider when creating your app:
What you can’t see can hurt you (or at least your app’s performance)
One of the biggest performance killers on iOS is transparency, especially in UITableViews. Limit their use, avoid using UIColor clearColor where possible, and remove the alpha-channel from any PNG you use that does not have transparency. If iOS sees an alpha channel in your image, it assumes there is transparency and will treat it as such. The Core Animation tool in instruments was demonstrated in combination with the iOS Simulator to detect how much transparency your app has in any given view.
Pixel fractions are your enemy
Another performance killer on iOS is inefficient drawing. If your graphic content is positioned on a pixel fraction (e.g. displaying an image at x-position 100.5) you are likely to end up with poorly rendered images as they will be rendered over two pixels instead of one. Always make sure your images are positioned at something point ZERO (e.g. x-position 100.0). Pixel fractions are bad!
Don’t block the main thread!
Parsing, loading data, and networking should never be done on the main thread. Additionally, these tasks should always be deferred to some point after applicationDidFinishLaunching. As a rule, your application should get the user to a functioning menu or UI as soon as possible. iOS gives you a maximum of 20 seconds from a cold start to finish your loading preparations, and will actually terminate your app if you go over this amount (on the device – the Simulator will let you take as long as you want), but Apple recommends you finish much quicker. “If your app takes more than 3-5 seconds to launch, you’re probably doing something wrong.”
If you have any performance tips you’d like to add, let us know in the comments!