New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-2461] Long compilation times with bridging header and 100s of .swift files #45066
Comments
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. |
Comment by Diego (JIRA) Thanks @belkadan, we'll hope for improvements in Swift 3 then. What about ClangImporter::importBridgingHeader? it takes about 32% of the time in our project |
Again, hard to know what's going on without actually seeing your bridging header and the things it imports. Are you sure you're not just including the one-time cost of precompiling imported modules? |
Comment by Diego (JIRA) Nah, I can literally see how files compile slowly in Xcode... I will try to synthesise a project that shows this issue! |
Comment by Diego (JIRA) @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. 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 |
Thanks, Diego! It's at least a setup that's investigatable. |
Attachment: Download
Additional Detail from JIRA
md5: b167791eaac0c50f1c8bcc3148c19f92
Issue Description:
Environment: Xcode 7.3.1. Swift 2.2 (can't migrate project to Swift 3 yet)
-Onone
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: