10% Build Time Improvement
- Select DWARF (without dSYM) for Debug Information Format (Debug config only).
- Remove
== true
, and replace== false
with condition negation, fast and simple for non-optional conditions only.
- Simplify expressions to help the compiler.
Notes:
- Xcode Find Navigator: Replace > Regular Expression >
(if|guard)(\s+)([\w|\.]+) == false
with$1$2!$3
- 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:
Published on: Feb 23, 2023