How to speedup xcode builds without any project modifications?

心已入冬 提交于 2019-12-02 18:32:28

I think I may got Xcode to build at decent speed with this command:

# Xcode 3.x
defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 4

# Xcode 4.x
defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4

This will limit the number of processes executed when it does build. Before adding this to my machine (4 cores/3GB RAM) the build process was slower than on single core!

I think that XCode is not able to estimate the right limit of subtasks by itself because it does the estimate by looking only at your number of cores and ignoring the amount of RAM you have.

For Xcode 4 this is now:

defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4

Take a look at Activity Monitor and see if any other processes are taking CPU time (e.g. Spotlight or Time Machine). Also look at the System Memory tab in Activity Monitor to see whether you're paging.

I recall seeing someone recently whose Xcode speed issues were resolved by reinstalling Xcode.

If you do this, you might want to save your documentation downloads and restore them after reinstalling. It will save you from a long download. You can find the documentation files by going to Preferences / Documentation. Click the little "i" next to a Doc Set and then choose "reveal in finder" from the small window.

Disabling code sense indexing can free considerable amounts of memory and CPU in large/complex projects, while speeding up the IDE itself.

Xcode 3

Use Preferences from the app.

Xcode 4

defaults write com.apple.dt.XCode IDEIndexDisable 1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!