My project consists of ~350 Swift files and ~40 cocoa pod dependencies.
As soon as the entire project was migrated to Swift 3
, build times have been INCREDIBLY slow and took a little over 3 minutes to completely compile.
I've noticed that if I rebuild after not changing any files, it builds within a reasonable amount of time. However, if I add a new function, it takes the 3+ minutes.
Cocoapods does not seem to be causing the problem as it delays on Compiling Swift source files
state.
I followed this to investigate:
Added the
-Xfrontend -debug-time-function-bodies
flag to myOther Swift Flags
in my target's build settingsBuild the project
Copied this into terminal and ran
pbpaste | egrep '\.[0-9]ms' | sort -t "." -k 1 -n | tail -100
However, I didn't see anything of concern. The file that took the longest to compile was only 250ms. The next closest was 100ms, even if all 350 files took 250ms to compile, that would only be a total of 73 seconds which is way off from the 3+ minute builds I am seeing.
What could be causing these long compile times?
It was never as slow before updating to Xcode 8
and Swift 3
.