user387184
user387184

Reputation: 11053

Speeding up compilation in xCode

I have a rather large project where compilation takes more than 1 hour on a Mac with i5 processor. Just changing one little piece of code at one place makes the complete long compilation necessary.

Is there any way to reduce this time?

I was thinking about "precompiling of classes" or "pre-linking" if there is anything like that. Even uploading a little app to a device takes 10 seconds.

ps Anyone can provide some experience whether xCode4.3 is faster on the new Mac Retinas in this context?

Many thanks!

Upvotes: 3

Views: 535

Answers (3)

lindon fox
lindon fox

Reputation: 3318

Recently I removed a few libraries that I had been referencing as .a files and moved the code in with the code. The speed increased amazingly. Compilation used to take 15min, now takes 15 seconds. Indexing used to take all day to finish (in time for shut-down), but now it is really fast. The library was on an network drive which may have been exacerbating the problem.

Upvotes: 1

Wolfgang Schreurs
Wolfgang Schreurs

Reputation: 11834

  • In your classes, make most of the imports in the implementation file (.m), not the headers. Use forward declaration when appropriate. See '@class vs. #import' and 'Importing header in objective c'

  • You might consider moving a stable and well confined part of your main project into a separate project and include it as a static library in the main project.

Upvotes: 1

David Hoerl
David Hoerl

Reputation: 41652

1) Use a precompiled header and remove any imports of those files (UIKite, Foundation, Cocoa, etc) which Xcode adds when you create classes)

2) Add reasonable stable user header files in the .pch as well - to reduce the precompile work.

Upvotes: 3

Related Questions