I notice there are two settings of optimization in the project settings :
What's the difference? And which one should we choose under what circumstances?
Whole module optimization is a compiler pass that can add significant performance gains, and so it's always worth enabling when doing a release build of your app for the App Store.
Whole-module optimization is an optimization mode of the Swift compiler. The performance win of whole-module optimization heavily depends on the project, but it can be up to two or even five times.
This optimization mode has the compiler run one frontend instance per file in your program. It runs optimizations on each file separately, loading as little information as it can from other files in the project.
Pros
Cons
This optimization mode will run one frontend instance for your whole module. It runs optimizations on all the files at once.
Pros
Cons
For debug builds, I highly recommend completely disabling optimizations. This will make stepping through your code in the debugger more predictable and will make build times shorter. If you really need optimizations, you should probably go with single-file for the better incremental compilation times.
For release builds, I recommend using whole-module optimization, as it can perform more optimizations than single-file optimization.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With