Extremely long compilation times with Swift in Xcode

I have three iOS projects:

  • The first is 35k Swift LOC, Swift 2.1 (or 2.0?) Compiled using Xcode 7.2.3
  • The second is 15k Swift LOC, Swift 2.3, compiled using Xcode 8.2.1
  • Third - 15k Swift LOC, Swift 3.0, compiled using Xcode 8.2.1

Compilation time for all of them is terrible (10 + minutes for a clean build), and development on each of them slows down the scan.

I already tried:

  • Using Whole Module Optimization
  • Change C Dialectfor default compiler
  • Analysis of the build time for the project and optimization of bottlenecks (several methods that required from 6 to 10 compilation with array concatenation, nil-coalescing operators, etc.) that shaved like 15 seconds are an absolutely imperceptible difference
  • HEADERMAP_USES_VFS = YES
  • A few others that I don’t remember now

I am working on a Mac mini Late 2014 with an SSD, 8 GB of RAM and a 2.6ghz i5 if that matters.

Does anyone know what can cause this, what to do with this or even workarounds? From what I read in SO and elsewhere, this seems like an unresolved compiler issue.

EDIT: Yes, I use Cocoapods for dependencies. I will try to move to Carthage and see what happens.

+6
source share
2 answers

Try setting the following as a workaround in the build settings. I assume that you have only one goal.

  • Set Build Active Architecture to Yes.
  • Set the optimization level to None [-Onone]
  • User-Defined "SWIFT_WHOLE_MODULE_OPTIMIZATION" "YES"
  • .

Swift: https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode

, 6-7 . Cocoapods , . 3 . , .

Update

User-Defined Debug " ". Other Swift Flags '-Onone'.

+5

Source: https://habr.com/ru/post/1016103/


All Articles