How to turn on xcode optimizations


My notes on xcode optimizations

Whole module

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. How it works is quite simple: when Swift builds the final version of your app it combines all your source files together and can evaluate the whole structure of your program at once. This lets it make extra optimizations that would be impossible before, when every file was optimized individually.

Optimization level

  • Set optimization level for debug to fastest, smallest (might want to toggle this if your not performance testing etc) Project target -> Build settings -> Optimization level

Build times:

You can enable a timer right within Xcodeโ€™s UI. This timer is not visible by default but if you run the following in the command line a time will be displayed each time you build your app.

defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES

After you have enabled the timer, you will see the time it takes to compile your app in the build status bar in Xcode.

๐Ÿ‘‰ Remember to clean your proj to show this build time ๐Ÿ‘ˆ

Build time details

Product โ†’ Perform Action โ†’ Build with Timing Summary option.

other: