Nefsu
Nefsu

Reputation: 428

What happens before applicationDidFinishLaunching is invoked?

I'm doing performance testing on my iphone app and I'm noticing that sometimes a good 3-4 secs elapse at startup before I start seeing my NSLogs from applicationDidFinishLaunching. I've optimized what happens once the code enters applicationDidFinishLaunching but I'm not sure how to optimize what goes on before that. I'm using a Default.png splash screen so it basically just stalls on that screen before it enters applicationDidFinishLaunching and starts doing something.

Just to give you guys some context, I have no nib files and I'm using core animation, if that makes any difference. I have about 10 different controllers and my total bundle size is just under 2MBs.

Upvotes: 0

Views: 532

Answers (2)

TechZen
TechZen

Reputation: 64428

I did some experimentation a little while back and found that default start time for most apps is 3 seconds or more.

I was annoyed that the voice memo apps took up to 10 seconds to launch by which time I had forgotten what I was going to say. I tried to write one that would launch faster and by using a default.png and starting the recording automatically I got a recorder that constantly launched in 1-1.5 seconds. To get that launch time, I had to start the recorder before the interface became active.

However, in this research I found that most apps e.g. an app compiled straight from an Xcode template without modifications, launched in 3-5 seconds.

Based on that fact, I would say you really don't have a problem. The startup time falls in the expected range. deanWombourne's observation about the debugger is most likely correct and it probably adds a second or two to your startup time.

Upvotes: 0

deanWombourne
deanWombourne

Reputation: 38475

Try running it without the debugger attached - one of the things it does on startup is wait to connect to your mac ;)

If you just run it in the device without your mac connected do you still see the delay?

Upvotes: 1

Related Questions