To run the example project, clone the repo, and run pod install
from the Example directory first.
A00LaunchMeasure is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'A00LaunchMeasure'
denglibing5, denglibing3@jd.com
A00LaunchMeasure is available under the MIT license. See the LICENSE file for more info.
系统的整理了启动阶段、原理、方案、工具等点
从背景到问题发现,优化过程,然后到原理,再到如何预防监控说明,比较系统的讲述了整个过程。其中也包含了比较多新知识(例如后台激活、启动后任务管理TTI、火焰图)。细节倒不是很详细
抖音品质建设 - iOS启动优化《原理篇》
抖音品质建设 - iOS启动优化《实战篇》
从动态库改静态库、二进制重排两个方向来优化
详细的介绍二进制重排方案
使用Pods能力来支持二进制重排,同时支持Pods中其他动态库
计算 +load 方法的耗时,靠谱,已经在使用:
详细的介绍如何检测load方法的耗时,技术方案全面靠谱,也有方案的选型细节和原因,非常好
兼容category的load方法,使用runtime(method_exchangeImplementations
)交换load实现然后进行耗时埋点
https://triplecc.github.io/2019/05/27/计算load耗时/
https://github.com/tripleCC/Laboratory/tree/master/HookLoadMethods/A4LoadMeasure
可视化工具,检测post-main的耗时,自动生成火焰图
Messier - 简单易用的Objective-C方法跟踪工具
目前不支持iOS15的机器,崩溃的原因应该和 fishhook 差不多。
fishhook解决方案:https://github.com/facebook/fishhook/pull/87/files
下载上面的 trace.json 文件,拖入到 chrome://tracing/ 可以看到效果
Total load time: 596.920967 ms
HDLoadFrameworkObj(HDLoad00) load time: 301.328063 ms
HDLoadFrameworkObj(HDLoad0) load time: 201.607943 ms
HDViewController load time: 51.537037 ms
messier_injector load time: 14.590979 ms
HDViewController(HDLoad) load time: 11.595964 ms
HDLoadFrameworkObj load time: 11.392951 ms
A00CppInitMeasure load time: 4.301071 ms
HDAppDelegate load time: 0.566959 ms
Total initializer time: 47.639012 ms
_GLOBAL__sub_I_TestStaticClassMemberMutex.cpp : 0.042081 ms
HDInitializerTest_Initializer : 41.468979 ms
HDInitializerTest_Initializer2 : 0.349045 ms
_GLOBAL__sub_I_TestRectZero.mm : 0.023961 ms
_GLOBAL__sub_I_TestVarVar.mm : 0.001907 ms
_GLOBAL__sub_I_TestMacro.mm : 5.074024 ms
_GLOBAL__sub_I_TestCBlock.mm : 0.002980 ms
_GLOBAL__sub_I_TestClass.mm : 0.676036 ms
Total post main time: 536.512167 ms
asycTasks-TTLoginTask load time: 377.533173 ms
asycTasks-TTDoneTask load time: 316.752350 ms
afterLaunchAsycTasks-TTRenderTask load time: 316.671448 ms
asycTasks-TTCompletionTask load time: 315.872375 ms
asycTasks-TTPrepareTask load time: 315.784119 ms
afterLaunchMainTasks-TTDownloadTask load time: 312.958099 ms
mainTasks-TTPearTask load time: 212.643372 ms
mainTasks-TTObserveTask load time: 211.551453 ms
asycTasks-TTPrefetchTask load time: 114.505920 ms
mainTasks-TTAppleTask load time: 111.962204 ms
asycTasks-TTProcessTask load time: 11.648625 ms
mainTasks-HDLaunchDemo load time: 0.355125 ms