3 ms·
Very anecdotal evidence: I work on a fairly large mixed Swift & Objc project and I was expecting a greater decrease in compile times. At first it seemed 'snapp
by adomanico 10y ago
Very anecdotal evidence: I work on a fairly large mixed Swift & Objc project and I was expecting a greater decrease in compile times.
At first it seemed 'snappier' but starting to notice not much of an improvement.
It definitely still feels like making small changes like changing a function name triggers a lot of extra work.
I should fire up some benchmarking of Swift 3.1 vs 3.0
- slavapestov 10y agoThere are two main sources of slow compile times in Swift -- the expression type checker has exponential in the presence of large numbers of overloads (which unfortunately includes arithmetic expressions and collection literals). The second is what I think you're hitting which is that incremental builds sometimes rebuild too many files because the dependency tracking is overly conservative. There was some work on the expression type checker in 3.1 (string interpolation, casts and a limited "domain shrinking" pass to simplify some arithmetic expressions) but the main focus there was centered on the declaration checker, in particular up the generics implementation to fix lots of crashes and limitations. Both the expression checker and incremental builds should receive more attention going forward though. In the meantime the usual workarounds might help - splitting up your codebase into multiple Swift modules ("targets" in Xcode), and splitting up complex expressions and adding explicit type annotations.
- slavapestov 10y agoAlso have you tried enabling precompiled bridging headers? This was added in 3.1 with the goal of speeding up mixed Swift/ObjC builds (by none other than Graydon Hoare), but other than that I don't know much about it.
- adomanico 10y agoUpon further inspection they disabled pre compiled bridging by default before release https://github.com/apple/swift/commit/5b9166ba8098a23e0601aac96ede363dea2484ae https://github.com/apple/swift/commit/5b9166ba8098a23e0601aa... After turning it on compilation speed seemed to improve immensely