Current location - Recipe Complete Network - Complete cookbook of home-style dishes - Xcode compiles slow packets and slow solutions
Xcode compiles slow packets and slow solutions
1. Increase the number of threads used in XCode compilation.

Defaultswritcom。 The CPU utilization rate of apple. xcode pbxnumberfilebuildtasks 48 will be extremely high, reaching 150%, and it is best to set it to 15 inch, otherwise employees may get stuck in other operations.

XCode uses threads with the same number of CPU cores for compilation by default, but due to the fact that IO operations are often more than CPU operations during compilation, appropriately increasing the number of threads can speed up compilation to some extent. I use a 4-core CPU, and the compilation speed is slightly improved after changing the number of threads to 8.

2. Change the debugging information format to DWARF.

In the building settings corresponding to the project goal, find the debugging information format of item, and change the dSYM file to DWARF when debugging.

This setting determines whether debugging information is added to the executable file. After changing to DWARF, if the program crashes, it will not be able to output the function stack corresponding to the crash position. However, since debugging information can be viewed in XCode debugging mode, changing to DWARF has little effect. After this change, the compilation speed can be greatly improved.

//Don't worry about this for the time being, the default configuration.

3. Change "Only build active schema" to "Yes".

In the build settings corresponding to the project goal, find the item "Build only the active schema" and change No when debugging to Yes.

This setting determines whether to compile only the version of the current mode. If not, all versions of the schema will be compiled. It should be noted that this option must be Yes in release mode, otherwise the released ipa will not run on some devices. After this change, the compilation speed can be significantly improved.

Set the above three items, I believe the compilation time will be shortened a lot.

4. How to turn off ccache to improve the speed of compilation and packaging? Write a script with the file name CCache.

Put it in the root directory of the Xcode project, and then

See this post for details.

/p/c9e3fb3dfa53

5. Delete the packaging cache

~/repository/developer /Xcode/ product