← Articles

10% Build Time Improvement

23 February 2023 · 1 min read

How I've got 10% Build Time Improvement in a Real-world App

  1. Select DWARF (without dSYM) for Debug Information Format (Debug config only).
  1. Remove == true, and replace == false with condition negation, fast and simple for non-optional conditions only.
  1. Simplify expressions to help the compiler.

Notes:

  1. == operator has a lots of overloads slowing compiler time
  1. Xcode Find Navigator: Replace > Regular Expression > (if|guard)(\s+)([\w|\.]+) == false with $1$2!$3
  1. Check expressions with long comple time using swift-flags: Build Settings ➔ Swift Compiler - Custom Flags ➔ Other Swift Flags:
-Xfrontend -warn-long-function-bodies=<limit>
-Xfrontend -warn-long-expression-type-checking=<limit>

Start with limit of 500 or 1000 milliseconds and move down to 100.

References: