Search
Goodies

Social Networks
Designs I Like
« Big surprise for tomorrow | Main | Ugly iPhone icons »
Wednesday
May122010

Speeding up application startup time

One one the thing I want to improve with Ultimate Password Manager is the application launch time, particularly on the first application launch. Currently, on the first generation iPod touch, one of the slowest device, the application launch time are:

Application first startup launch times:

  • Version 2.1.0.175: 12 seconds
  • Version 2.1.1.185: 13 seconds

The time is measured from the touch of the application's icon on the iPhone home screen to the first visual change in the user interface while looking at the default splash screen. This is a good measure because this is the most critical period where the user's perception of the application speed is in full swing. I could extend that measurement to include the time for the application to become fully operational but since my application animate its splashscreen, this is less required as the user watch the small animation occurring.

After optimizing the application delegate method applicationDidFinishLaunching, the new launch time are:

2.2.0: 5 seconds

For all versions of my application, the application launch times are 2.5 seconds which is not bad.

How I did the optimization? By splitting the code in applicationDidFinishLaunching as chunk. Before, this method was a long series of steps and tasks that was using to perform application runtime data structures and loading. By splitting these tasks in smaller methods, I can then schedule those in NSOperation queue operations.

NSOperationQueue *queue = [NSOperationQueue new];
// Execute this on a seperate thread
NSInvocationOperation *operation1 = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(formatDictionaries) object:nil];
NSInvocationOperation *operation2 = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(formatHistory) object:nil];
NSInvocationOperation *operation3 = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(formatSubstitutions) object:nil];
/* Add the operation to the queue */
[queue addOperation:operation1];
[queue addOperation:operation2];
[queue addOperation:operation3];
[operation1 release];
[operation2 release];
[operation3 release];
[queue release];

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>