View compile time
Terminal execution:
defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES
Copy the code
Restart Xcode. After compiling, you can see the compile time at the top
Optimization of item
Swift type check Time detection: Add the following Settings to xcode => Build Settings => Other Swift Flags to see how long the swift expression and function type check takes. Any longer than a given time will give a warning.
- dSYM
Debug can be set not to generate dSYM, but only when it is released or otherwise needed.
-
Third party library modularization, reduce dynamic library
The third party library will be recompiled after clean, so please pack pod third party library into.a file first, how to do it, try later!
-
PCH file optimization Check the PCH file and delete unnecessary header files
-
Write as few references as possible to.h files. Try to write references in.m files
-
Delete unnecessary references unnecessary classes, etc delete. Appcode can be used to quickly check items.
-
Swift optimization a. Optimize Swift compilation options and set whole Module to merge Swift into one, which can greatly reduce compilation time
B. Reduce type inference
-
Increase the number of Xcode compilation threads
By default, Xcode uses the same number of threads for compilation as CUP verification, but since compilation tends to involve more IO operations than CPU operations, the number of compiled threads can be appropriately increased
1. Obtain the current number of cores sysctl -n hw.ncpu 2. For compilation thread number defaults read xcodebuild IDEBuildOperationMaxNumberOfConcurrentCompileTasks 3. Threads can be modified according to the performance of the Mac defaults write xcodebuild IDEBuildOperationMaxNumberOfConcurrentCompileTasks 6 ` ` `Copy the code