IOS minimum startup time

I have a project in Swift and when I measure it with DYLD_PRINT_STATISTICS I can see 1 second time before initialization starts where 70% is dynamic link linking.

Are there any clean and safe ways to solve this problem?

+3


source to share


1 answer


According to Apple's WWDC 2016 report on Optimizing Application Startup Times , regardless of their size, having a large number of dynamically linked libraries slows down application startup times significantly.

To fix this, multiple dynamic link libraries can be combined into one library. If they are already static libraries then libtool can be used to combine them using this SO answer command . However, if they are not static, then in order to combine them, you must have access to their source code. If the source code is available, then literally copying the code from one library to another and using the resulting library will suffice.



Of course, combining disparate libraries into one of them is definitely inconvenient from a developer's point of view. To combat this, Xcode allows you to link different libraries when different flags are set (like RELEASE and DEBUG), as described in this forum .

Whenever possible, it is best to merge static libraries as the merging process is much less error prone. CocoaPods allows users to use static libraries in their projects.

+1


source







All Articles