30 ms·
Tip to reduce compile times: 1. Use modules. 2. In Xcode, go to your target, go to Build Settings, and at Other Swift Flags, add the following flags: -Xfronte
by bartvk 9y ago
Tip to reduce compile times:
1. Use modules.
2. In Xcode, go to your target, go to Build Settings, and at Other Swift Flags, add the following flags:
-Xfrontend
-warn-long-expression-type-checking=400
This will issue a warning when the Swift compiler takes more than 400ms when deducing the type for a particular expression. If you get no warnings, lower to 300, and if necessary to 200.
Anyone have other tips?
- steeve 9y agoI'm kind of sad this flag exists to be honest....
- dep_b 9y agoType all of your more complex statements and block parameters, especially when you're chaining complex stuff. It's much easier to verify that the types you've stated are correct than to calculate all the possibilities that a type might have.
- andrewmcwatters 9y ago1. Sounds pretty sane. 2. is tragic.
- kobeya 9y ago400ms is about a billion clock cycles. If it takes a billion clock cycles to type check an expression, something is very very wrong.