Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
422 views
in Technique[技术] by (71.8m points)

swift - iOS App pre-main time optimisation (app launch time)

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:

  1. How to optimize dylib loading time. Does this time depend on my code? or just the number of frameworks?
  2. Why FirebaseInstallations need so much time? Am I somehow initialise it incorrectly?

Thoughts:

  1. 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.
  2. Using static libraries?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...