Slow test file compilation in Swift 1.2, Xcode 6.3

2020-06-27 06:01发布

问题:

I experienced much slower compilation of the swift unit test files after migrating the project from Xcode 6.2 to 6.3.1.

My unit test use Quick/Nimble framework. Also in each test file I have:

import MyApp

The interesting thing is that when I comment out that import, the compilation is lightning fast. I tested it out on some dummy unit test files, that in fact don't use any of my application's code. But that import makes huge difference for the compilation time.

I didn't observe that big impact when using Xcode 6 - 6.2. Do you have any ideas how to improve the compilation speed now?

回答1:

According to one of the replies in http://devforums.apple.com/message/1128702#1128702 . Enabling Whole Module Optimization in Build Settings makes the issue walked around.



回答2:

Obviously this would involve seeing your code but try to not use so many concatenations for your strings and strongly type your vars.

You can see which file is taking a long time to compile by watching the build process in Xcode file by file. It's the last tab, touch the running build process and you'll see each file as it's being compiled.



回答3:

Apple released Xcode 6.3.2 on 18th May (yesterday) which seems to cite slow compile times. Does the update fix your issue?