I want to optimize the startup time of my application, but I ran into a problem that I can't solve through profiling. I am using cocoapods with use_frameworks running swift 5
Here is my DYLD_PRINT_STATISTICS:
Total pre-main time: 1.0 seconds (100.0%)
dylib loading time: 573.96 milliseconds (55.8%)
rebase/binding time: 129.30 milliseconds (12.5%)
ObjC setup time: 17.08 milliseconds (1.6%)
initializer time: 307.09 milliseconds (29.8%)
slowest intializers :
libSystem.B.dylib : 6.10 milliseconds (0.5%)
libMainThreadChecker.dylib : 26.01 milliseconds (2.5%)
FirebaseInstallations : 124.69 milliseconds (12.1%)
Realm : 34.41 milliseconds (3.3%)
ServiceCore : 73.93 milliseconds (7.1%)
Questions:
- How to optimize dylib loading time. Does this time depend on my code? or just the number of frameworks?
- Why FirebaseInstallations need so much time? Am I somehow initialise it incorrectly?
Thoughts:
- Optimize dylib loading time by combining frameworks using cocoapods-pod-merge plugin. This is a rather expensive optimization, since many frameworks depend on each other. I don't think it will be possible to optimize this much.
- Using static libraries?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…