Here are the steps on how to gather metrics about your app launch via Instruments. Profile is compiling the app on the release mode and take advantages of compiler time optimization. With Xcode 11, Instruments comes up with a new template named App Launch to gather metrics of your app launch.īefore launching Instruments, on thing you need to do is to Profile your app to a physical device. Profiling will help you to find the issues in your app, including the location and details of the issue so you can fix them. Xcode provides Instruments which supports various tools for memory profiling, cpu profiling, time profiling, network profiling, etc. Let’s dive into ways to get metrics of your launch time with Xcode 11+ and iOS 13 What you do before making the first screen visible: If you are loading external dependencies (eg: Analytics frameworks), initializing data layers (eg: CoreData), this will take time before your user could see the first screen and may impact the launch.Number of dynamic dependencies: The more you have, the longer your launch time will be.OS version: iOS 13 did some optimization with caching dynamic dependencies for apps, which significantly improves the warm launch, prior versions of iOS don’t benefit this improvement.Device type: The older the device, the longer it will take to load libraries. (yikes) Also, if your app takes more than 20 seconds, the OS will automatically kill the app (Watchdog), this only really concerns the oldest devices usually, so watch out.Īll those parameters counts in the launch time assessment: Apple recommendation is to have maximum 6 dynamic dependencies. It is not necessary to count Apple’s dynamic framework loading. To see the number of dynamic dependencies your app has, add the environment variables DYLD_PRINT_LIBRARIES=1 to your run app scheme.Ĭount each lines printed like above to know the count of your app dynamic dependencies. How do I know the numbers of dynamic frameworks linked to my app? This could accumulate a lot of linking at launch and could then impact your launch time. If you are using Cocoapods / Carthage, you might have a consequent amount of dependencies, with then might even also trigger transitive dependencies (Basically dependencies including their nested dependencies etc.) Having many frameworks linked as dynamically makes the OS system to do many bindings, which then increase the pre-main time.
0 Comments
Leave a Reply. |