Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode 8.0 app building ultraslow

Problem is that when building a Swift app in XCode 8, the source files are compiled quickly, but Copying Swift standard libraries takes the cake - the phase could run for several minutes (usually the whole build is around 4-5 minutes, worst cases have been generously over 10 minutes – used to be under a minute).

Additionally, the signing phase of archive's export is painfully slow, sometimes taking close to half an hour (again, used to be quite quick).

I've scoured the web for answers for days, reinstalled XCode countless times, tried new Swift toolchains, experimented with turning on/off Sierra's iCloud Drive (the derived folder still needs to be hidden from it), tried every build setting that anyone, and their mother, has recommended, made numerous new blank projects, and lost all hope...

So my question is, how can i make it normal?

EDIT: I also have 867 Apple ID keys (same amount of pub-s and priv-s, and the accompanying certificates) in my Mac's Keychain – is there a chance this issue is related to it? Takes a ton of time to go through them and find the correct one to sign with?

like image 633
Mikk Rätsep Avatar asked Oct 05 '16 11:10

Mikk Rätsep


2 Answers

So... i finally snapped and deleted all my Apple ID keys (except 1 key pair) from my Keychain (was terrified about breaking things). Now everything builds quickly / normally and i can finally be happy again...

Just to reiterate – make sure you don't have duplicate keys in Keychain.

like image 120
Mikk Rätsep Avatar answered Nov 15 '22 13:11

Mikk Rätsep


Go to project settings, then Editor > Add Build Setting > Add User-Defined Setting, and add the following:

SWIFT_WHOLE_MODULE_OPTIMIZATION = YES

Adding this flag dropped our clean-build compile times from 7 mins to 65s for a 40KLOC swift project, miraculously. Also can confirm 2 friends have seen similar improvements on enterprise projects.

I can only assume this is some kind of bug in Xcode 8.0## Heading ##

like image 30
Chris Avatar answered Nov 15 '22 14:11

Chris