Edit Scheme > Run > Arguments > Environment Variables
添加变量 Name DYLD_PRINT_STATISTICS
Value 设置为 YES
可以看到APP在执行main
函数之前的操作花费的时间
Total pre-main time: 158.84 milliseconds (100.0%)
dylib loading time: 54.81 milliseconds (34.5%)
rebase/binding time: 29.42 milliseconds (18.5%)
ObjC setup time: 47.20 milliseconds (29.7%)
initializer time: 27.23 milliseconds (17.1%)
slowest intializers :
libSystem.B.dylib : 2.49 milliseconds (1.5%)
libMainThreadChecker.dylib : 14.97 milliseconds (9.4%)
网友评论