There are three main ways to improve the speed of compilation and linking:
1. Increase the number of threads used during XCode compilation
defaults write PBXNumberOfParallelBuildSubtasks 4
XCode uses threads with the same number of CPU cores by default to compile, but since there are often more IO operations during the compilation process than CPU computing, appropriately increasing the number of threads can speed up the compilation speed to a certain extent.
2. Change Debug Information Format to DWARF
In the Build Settings corresponding to the Target of the project, find the Debug Information Format item, and change the DWARF with dSYM file during Debug to DWARF.
This item sets whether to add debug information to the executable file and change it to DWARF. If the program crashes, the function stack corresponding to the crash location will not be output. However, since debug information can be viewed in XCode in Debug mode, changing it to DWARF has little impact. After this change, it can greatly improve the compilation speed.
3. Change Build Active Architecture Only to Yes
In the Build Settings corresponding to the Target of the project, find the Build Active Architecture Only item and change the No during Debug to Yes.
This item sets whether only the current schema version is compiled. If No, the versions of all schemas will be compiled. It should be noted that this option must be Yes in Release mode, otherwise the published ipa will not be able to run on some devices. After this change, it can significantly improve the compilation speed.
After setting the above three items, I believe that the compilation time will be much shorter.
The above is the entire content of this article, I hope you like it.