Environment
Xcode Version 7.3 (7D175)
Apple Swift version 2.2 (swiftlang-703.0.18.1 clang-703.0.29)
Mac OS X El Capitan Version 10.11.2
Macbook Pro 2013
Additional Detail from JIRA
| | |
|------------------|-----------------|
|Votes | 0 |
|Component/s | Compiler |
|Labels | Bug, Performance, TypeChecker |
|Assignee | None |
|Priority | Medium |
md5: abf3f7481d2e17a47d1051d1f00d2195
Issue Description:
Radar Number: 25866240
Adding one ore more collections together using the + operator increases build times drastically, and exponentially for each additional collection added.
The sample code provided in the radar / attached example project demonstrates this issue by creating a few String arrays, then trying to concatenate all arrays together by using the + operator. As you'll see, the project takes extremely long to build. This is demonstrated in the example project's ViewController.swift file.
Below the long-running example, the same outcome is achieved by creating a mutable collection and calling appendContentsOf() on it for each additional array to achieve the same result. If you comment out the line that uses the + operator to combine the arrays, the project will build instantly. Uncommenting it will cause the build process to take an exceedingly long amount of time during Compile Swift Source Files, so much so that the Mac's fan will spin up.
This problem was discovered while working on a much larger project with a few hundred Swift files, where build times were reaching 20-30 minutes and timing out on our CI machines.
Attachment: Download
Environment
Xcode Version 7.3 (7D175) Apple Swift version 2.2 (swiftlang-703.0.18.1 clang-703.0.29) Mac OS X El Capitan Version 10.11.2 Macbook Pro 2013Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, Performance, TypeChecker | |Assignee | None | |Priority | Medium | md5: abf3f7481d2e17a47d1051d1f00d2195Issue Description:
Radar Number: 25866240
Adding one ore more collections together using the + operator increases build times drastically, and exponentially for each additional collection added.
The sample code provided in the radar / attached example project demonstrates this issue by creating a few String arrays, then trying to concatenate all arrays together by using the + operator. As you'll see, the project takes extremely long to build. This is demonstrated in the example project's ViewController.swift file.
Below the long-running example, the same outcome is achieved by creating a mutable collection and calling appendContentsOf() on it for each additional array to achieve the same result. If you comment out the line that uses the + operator to combine the arrays, the project will build instantly. Uncommenting it will cause the build process to take an exceedingly long amount of time during Compile Swift Source Files, so much so that the Mac's fan will spin up.
This problem was discovered while working on a much larger project with a few hundred Swift files, where build times were reaching 20-30 minutes and timing out on our CI machines.