Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Measuring iPhone application load time

I am in the process of optimizing an iPhone app for very short load time and am wondering:

Is there a means of measuring the load time of an iPhone app from the time the user taps the icon to the time that the app is usable (or at least –viewDidLoad gets called)?

Ideally this would work in the device and simulator, but if someone has found a way to measure this time exclusively in the simulator that would at least be a starting point.

And no; "stopwatch" or "one Mississippi, two Mississippi" do not count. :-)

like image 214
Kevin L. Avatar asked Jul 14 '09 21:07

Kevin L.


1 Answers

Start a timer in the init method of the App Delegate, and then stop when the viewDidAppear:-

Start timer with:-

NSDate *startTime = [NSDate date];

...and end with:-

NSTimeInterval elapsedTime = [startTime timeIntervalSinceNow];
NSLog(@"Startup tasks: %f", -elapsedTime);

This won't start from the moment the icon is tapped, but should be fairly early into your workings. You could probably view an earlier time in the logs put out in the debugger console?

like image 66
Purpletoucan Avatar answered Oct 04 '22 21:10

Purpletoucan