Speed up XCode compilation Link (200% +)-solution for slow XCode compilation, xcode200 %

Source: Internet
Author: User

Speed up XCode compilation Link (200% +)-solution for slow XCode compilation, xcode200 %

Recently, I encountered a headache when developing a large project. Due to the large amount of project code, every time I compile the link for about 1 minute, debugging is a waste of time, so I studied how to increase the speed of compilation links. I will share it with you here.

There are three ways to increase the speed of compiling links:

1. Increase the number of threads used for XCode Compilation

 

[Plain]View plain copy  
  1. Defaults write com. apple. Xcode PBXNumberOfParallelBuildSubtasks 4


XCode uses the same thread as the number of CPU cores by default for compilation. However, since the number of I/O operations in the compilation process is usually more than that in the CPU, therefore, appropriately increasing the number of threads can speed up compilation to a certain extent. I use a 4-core CPU. After changing the number of threads to 8, the Compilation speed is slightly improved.

 

 

2. Change the 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 in Debug to DWARF.

This item sets whether to add debugging information to the executable file. If the program crashes, the function stack corresponding to the crash location cannot be output, however, in Debug mode, debugging information can be viewed in XCode, so changing to DWARF does not have much impact. After this item is changed, the Compilation speed can be greatly improved.

Note that changing the Debug Information Format to DWARF will make it impossible to view the value of member variables of the relevant class type in the Debug window. When you need to view these values, you can change the Debug Information Format back to DWARF with dSYM file, clean (required), and then re-compile.

 

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 option and change No in Debug to Yes.

This item sets whether to compile only the version of the current architecture. If it is No, it will compile the versions of all architectures. Note that this option must be set to No in Release mode; otherwise, published ipa will not run on some devices. After this item is changed, the Compilation speed can be significantly improved.

 

After setting the preceding three items, the compilation time is reduced from about 1 minute to about 10 seconds, so the effect is quite obvious.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.