How to speedup xcode builds without any project modifications?
Asked Answered
L

5

10

Last version or XCode (3.2.1) is running very slow on OS X 10.6.

What kinds of tweaks can you do to your Mac in order to speedup Xcode build process.

I'm not looking for general hints like how to restructure your projects, just tweaks that are related to environment.

For example I remember that on Windows for Visual Studio two significant speedups are to disable antivirus and NTFS last access time.

So I'm aiming at something else than: hardware upgrades, project structure modifications or configuring distributed builds.

Update #1 - maybe limiting the number of cc1plus processes could help speeding up. I think there is an environment variable that can be used for this but I wasn't able to relocate this info.

Lotze answered 5/2, 2010 at 17:8 Comment(0)
L
17

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.

Lotze answered 5/2, 2010 at 19:27 Comment(1)
I think that simple single line command is the most important thing anyone could do to change there life, if they are using Xcode as a c++ compiler. It really is life changing! I was having nightmares with Xcode, till I limited the number of cores it was using. System freezing, all my RAM was being used up. I was even gonna buy an entirely new system, then this single command came a long, man! Someone should really tell the Xcode developers.Ambert
A
1

For Xcode 4 this is now:

defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4

Ambert answered 29/9, 2011 at 7:48 Comment(0)
P
0

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.

Pianism answered 5/2, 2010 at 17:44 Comment(2)
"Spinning wait cursor" appears from time to time. Lookng at system monitor I observe that most of the cpu time is used by ~5 cc1plus processes (machine has 4 cores/4GB RAM). Still the CPU usage is not so high but now Xcode is marked as "not responding".Lotze
Oops, now I see 9 cc1plus processes - this should not happen with 4 cores.Lotze
I
0

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.

Insight answered 5/2, 2010 at 18:26 Comment(0)
D
0

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

Doura answered 16/10, 2011 at 5:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.