4 ms·
Set your optimization level to -Onone & then manually set SWIFT_WHOLE_MODULE_OPTIMIZATION in user defined variables to YES. Your build times will improve greatl
by mahyarm 10y ago
Set your optimization level to -Onone & then manually set SWIFT_WHOLE_MODULE_OPTIMIZATION in user defined variables to YES. Your build times will improve greatly.
Xcode only lets you do WMO & optimizations on in the normal UX. Really bad that they don't expose this :/
Also to other people thinking about swift: don't. 200-100kloc and your build times become 5-20+ minutes. The conditional compiler is not very good either. And once your at that level of code, xcode spins it's indexer for a long time, autocomplete fails a lot and the debugger just doesn't work that well. Printing an object just spins for over a minute, and often it fails to even print the variable. Also configuring your project into many modules become painful with all the targets you have to manage.
Maybe in 4+ years when the language has matured enough and these issues start going away? And you have a build system that doesn't depend on large multimegabyte xml files that can't be written by a human. But for now, no.
It's good enough for a couple of developers doing contract apps although!
- Aker89 10y agocan also recommend this approach at the moment: http://khanlou.com/2016/12/guarding-against-long-compiles/ http://khanlou.com/2016/12/guarding-against-long-compiles/ This makes XCode warn you about functions with long compile times.
- dep_b 10y agoWow, just what I needed! I posted a rant a few days ago here where I advocated for just this thing!
- codesternews 10y agoThanks!! Done already all this. On developer forums apple developers said they messed with the Xcode so wating for next Xcode release. That's what I am talking about :( https://forums.developer.apple.com/thread/62737 https://forums.developer.apple.com/thread/62737
- rudedogg 10y agoI don't think that's how whole module optimization works. From what I understand it slightly slows down compilation, but you end up with more performant apps. For this reason I think it's only used for Release builds (that's how I have it setup). https://swift.org/blog/whole-module-optimizations/ https://swift.org/blog/whole-module-optimizations/