Swift WHOLE_MODULE_OPTIMIZATION improves compile time, but causes lldb/Xcode crash
I've worked and I am actively working on projects that are probably even larger than yours (50+ libraries, hundreds of custom classes with thousands of LoC). It takes few seconds to compile and up to 2 minutes for release build (Late 2013 MBP), even for full Swift project.
I would highly recommend to look for other causes, as what this option tells you is that your problem is somewhere else since it affects app performance, not building speed. Maybe you have your .pch file full of stuff that does not belong there or something, it can cause this kind of slowing.
Other interesting thing is use of inference. I personally declare type for every single variable just because it is easier to read for others, but there is more to it. Since the inference can get complicated, it can cause compiler to take A LOT of time to figure out what your code actually does. Read this example article, though it was more like alpha-problem. BUT MAYBE, just maybe, you have something like this in your code as well. What would be worth doing is trying to remove all the swift code, compile libraries if that works well, then you know the problem is in your swift code and it will be probably connected to this.
Also, if you provide WHAT actually slows your build time (because you can see whole build process with timestamps, and there is high probability that one step will just take forever), it can help pinpoint the problem more accurately.
Hope it helps!
Edit: Another article on this interested topic
I managed to fix this in our project. (12 mins total compile time)
The key is to set the
SWIFT_WHOLE_MODULE_OPTIMIZATION = YES as you say in the
user defined settings
But you need to do one more change. You need to set the optimization level to
None in debug otherwise you will not be able to debug your app.
I wrote a blog post about it here: