I like Apple
and the things they do, but Swift
... OH GOD!
Configuration:
Compile time: 3 min.
Looks like for "new best and amazing swift, the dream" this configuration is not enough and it works like Google Chrome
- InfiniteLoop(find free memory - eat)
HEADERMAP_USES_VFS
to YES
(no change) Build Settings / Architectures / Build Active Architecture Only
to YES
(some improvement)Set defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 4
(8)
(sometimes it's become even worse)
Set optimisation level to -Onone
(no major improvement)
DWARF
instead of DWARF with dSYM File
Find implicit dependencies
from your scheme (no major
improvement)Created a new project and moved all files to the new one (takes too long and give small time improvement)
Change compilator from default to others available (even worse)
Strict rules on how to write fast compiled Swift code (below more details)
I've found a few posts where people describe the same problem: here and here
I guess everyone is waiting for new Xcode 8.2 beta 2
where:
Xcode will not rebuild an entire target when only small changes have occurred. (28892475)
But this is only partially true, I still have long compile time - moved from 6-12 minutes to 3-8. Detailed description of this can be found here and here
Also, I followed all these rules during code writing:
In othe words, don't use any "new cool features" because you'll wait for ages.
One more try - is a workaround described here:
Go to Product -> Scheme -> Edit Scheme. Select Build in left side column and uncheck "Find implicit dependencies" But this flag should remain checked when you are building the project for the first time.
But, this workaround isn't what I'm looking for and this is also can be as a temporary solution.
Swift
is a pain not because it's hard to write, but because it's hard to use (at least on some machines).
For comparison: I have a project on Objective-C
with 2k classes, and 11 pods - clean compile time is ~30 seconds.
Also I found a lot of opened bugs on swift performance:
My question is:
This issue has been extremely frustrating for me as well. We've tried several of the solutions you've mentioned and none of them worked.
The one thing that made a significant improvement in compilation time is:
Turning on the Whole Module Optimization
while adding -Onone
in Other Swift Flags
.
See this - Speed Up Swift Compilation
I'm using Swift 3
with Xcode 8.3
.
We improved our compile times a lot by using Carthage instead of Cocoapods to include third party libraries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With