Cold start
Cold start is the process of starting from scratch after the app is killed. Hot Start
When the user presses the home button, the iOS app will not be killed immediately and will continue to survive for some time. Ideally, when the user clicks on the app icon and comes back, the app needs to do almost nothing to restore the status before exiting and continue to serve the user. This continuous survival scenario starts with the app called Hot start. Cold start specific heat start important
Apple's method of measuring startup time-consuming
Select Project→scheme→edit Scheme in the Xcode menu, then locate Run→environment variables→+ and add an environment variable named Dyld_print_statisticsvalue 1.
After the app runs:
before the main () function
A total of 52.27ms is used
Load Dynamic Library time consuming: 15.85ms
Pointer relocation time consuming: 5.68ms
OBJC class initialization time consuming: 7.10ms
Various initialization time consuming: 23.58ms
Of the three initialization costs, the maximum number of initialization is
Libsystem.b.dylib
Libbacktracerecording.dylib
Libmainthreadchecker.dylib
Modelio
after the main () function
From the main () function to the end of applicationwillfinishlaunching, we unify the part that is called after the main () function.
This example is to start the empty app, so this part is not time-consuming. In fact, many apps are optimized for this part of the startup time after the main () function.