Cold start

Cold start is the process of starting from scratch after the App is killed.

Warm start

When the user presses the home button, the iOS App is not killed immediately, but continues to live for some time. Ideally, when the user clicks on the App icon and comes back, the App needs to do very little to return to its original state and continue serving the user. This continuous survival of the launch of the App is called hot launch.

Cold start is more important than hot start

To measure startup time, choose Project→Scheme→Edit Scheme from the Xcode menu, and then go to Run → Environment Variables →+, Add the environment variable DYLD_PRINT_STATISTICSvalue 1.

After the APP is running:

The main() function used 52.27ms in total. Loading the dynamic library: 15.85ms. Pointer relocation: 5.68ms. Initialization of ObjC classes: 7.10ms

In initial cost 23.58 ms, three teeching initialization is libSystem B.d ylib libBacktraceRecording. Dylib libMainThreadChecker. Dylib ModelIO

After the main () function From the main () function to applicationWillFinishLaunching ended, we unified as the main () function after part. This example starts the empty APP, so this part is not time-consuming. In fact, many apps optimize the startup time after the main() function.