Environment: Xcode 7.3.1. Swift 2.2 (can't migrate project to Swift 3 yet)
We're suffering very long compilation times in our project.
Each swift file takes more than 1 second to compile
If I have a file with 3 classes takes 1/3 of the time if I do 1 file per class
Stack trace shows 2 slow paths: bridging header and type checking.
Looks to me that importing the bridging header could be done once per module instead of file, saving some time. Not sure also if much of the work of the type checking can be calculated up-front (maybe some kind of whole-module with -Onone so debug works?). Maybe there are some improvements already for Swift 3, but this project is quite big and we won't migrate until the final version.
The text was updated successfully, but these errors were encountered:
I'm afraid without a project there isn't much we can investigate here. However, we have fixed the issue with some variables being type-checked once per file instead of just when needed. Further improvements to Swift 2.3 are unlikely.
@belkadan I've attached some projects. 351 swift files and 701 obj-c files with empty methods. It's not as slow as ours but the same heavy stack traces appear in the profiler.
Swift 3 compiler is slightly faster than Swift 2, but it doesn't look like it will improve our compilation time dramatically.
Swif-3-one-file has all the code in a single file, which improves compilation time dramatically. The whole app compiles in 30 s in my machine (3x faster).
In our project, we suffer from these compilations from scratch when pulling code from upstream and, more often than we wanted, also randomly, but this would be a separate issue.
Hopefully there's room and resources for improvements in this area