I am keeping a close eye on the start time of my app in development. In main
I store the start time using CFAbsoluteTimeGetCurrent()
and log elapsed time when didFinishLaunchingWithOptions
gets called, as well as during the initialization and painting of my StopWatchView
and finally in the viewDidAppear
of the main view controller. This served me very well in figuring out where my start time goes and keeping it in check. My startup performance tests on actual devices were done on iPhone 3G (iOS 4.2.1) and iPhone 4.
Since upgrading the device to iOS 5.1 I was forced to upgrade the Xcode to the version 4.3.1, too. I have immediately noticed that the start times on iPhone 4 changed dramatically. All measurements were performed with Xcode attached for debugging, reading the elapsed times from logs in console. Now I've also added debugging label that displays elapsed time to be able to measure without debugger attached.
To eliminate the possibility that the change was caused by something in my code, I've created new Utility Application and confirmed the slowdown. The iPhone 4 used to be ~3x faster than iPhone 3G, now it starts slower(!!!) than 3G. The startup time has also become highly volatile (+- 0.3s), where it used to be +-0.05s. The volatility disappears in Airplane Mode, so I suspect it's caused by some background process related to iCloud. However I'm very puzzled by 3x slower startup time on iPhone 4 before and after the upgrade.
Here are the average startup times, first during debugging in Xcode (then without Xcode):
Debug No-debug
iPhone 3G: 1.23s (0.67s)
iPhone 4: 0.43s (-----) [iOS 5.0.1, Xcode 4.3]
iPhone 4: 1.53s (1.18s) [iOS 5.1, Xcode 4.3.1]
iPad 2: 0.41s (0.22s) [iOS 5.1, Xcode 4.3.1]
I don't know if this is caused by iOS 5.1 or Xcode 4.3.1 or if this is iPhone 4 specific problem. Does anybody see similar slowdown?