I have an iOS application that grabs frames from the devices camera and does some quite CPU intensive image processing. On the iPad 2, iPad 3 and iPhone 4s the application happily runs at 30 frames per second (fps). I recently tested it on an iPhone 5 and most of the time it runs at 30 fps. Occasionally i've noticed it drop to around 15 fps, something I've never experienced on the other devices (devices that supposedly have slower hardware). I've tried hard to track this issue down, and I've learn a bunch of stuff but not found an explanation. Here are some of my observations that might give clues to what is going on:
- It only happens on iPhone 5
- I cant recreate the problem when trying to profile the application on the phone
- The application is running on multiple threads, the frame grabbing and and converting the image into my required format run on a separate thread to the intensive image processing. The frame grabbing thread never drops below 30fps, its only the image processing thread that drops. This means that my problem is not due to the cameras frame rate dropping for some reason (such as low light levels).
- I tend to be able to recreate the problem by starting the app, hitting the iPhones standby button, hitting the home button and going back into the application. If I repeat this 3-6 times the problem often occurs (but not always).
- Doesn't appear to be related the iOS 6.0, it works fine on a 4s with iOS 6.
- When the problem has occurred, even killing the app and restarting it often doesn't bring the framerate back up (suggesting its an issue outside of my app related to the iPhone 5).
- Connecting the phone to my computer and rebuilding the app always seems to resolve the frame rate issues.
This is very odd. Could it be that the iPhone 5 reduces the clock speed of the phone sometimes to help with battery life (in a way that iPads and the iPhone 4s doesn't)?
I'd love to hear from anyone who as had similar experiences.
My application shouldn't look worse on iPhone 5 it should look better!
Many thanks in advance,
Kevin
Update
I've done some more tests but have still not found the problem. This is what I tried.
- I've removed the threading
- I've removed some third parties I was using
- Removed all logging
- Tried to recreate in instruments and failed. The problem does not occur in instruments
I've run out of ideas. Love to hear from any one who has experience frame rate slowdowns on the iPhone 5? Does the iPhone 5 have a power save mode?