I've been asked to reduce the startup time of an iOS application. I am very familiar with the platform/tools in general but I haven't focussed upon application startup time before. I'm wondering if there are known patterns for attacking this problem?
I realize that I can simply measure the time it takes to go from main() through the completion of application:didFinishLaunchingWithOptions:
(which includes any background loading tasks), but again, I am hoping there might be a more standardized way to do this.
Any suggestions would be greatly appreciated!
-M
from WWDC 2012 session 235
set the start point at the first line of code in main.m
#import <UIKit/UIKit.h>
CFAbsoluteTime StartTime;
int main(int argc, char *argv[])
{
StartTime = CFAbsoluteTimeGetCurrent();
@autoreleasepool {
...
set the end point somewhere in AppDelegate
's application:didFinishLaunchingWithOptions:
extern CFAbsoluteTime StartTime;
...
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Launched in %f sec", CFAbsoluteTimeGetCurrent() - StartTime);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With