Swift Compiler slows down with nested type inference
| Originator: | anthony.r.dipasquale | ||
| Number: | rdar://18489684 | Date Originated: | |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 6 |
| Classification: | Performance | Reproducible: | Always |
Summary: When creating some generic operators that rely on type inference to function, chaining too many of them together can cause the compiler to dramatically slow down. If you try out the example code from the "Steps to reproduce", you can see this yourself by commenting out the `TestModel` class. When it is commented out the test suite builds quickly and the tests pass. When it is uncommented, the test suite takes an impractical amount of time to build. If you comment out all the properties and associated methods then add them back in one at a time, running the test suite each time in the `TestModel.swift` file, you'll see that the build starts to slow down with the `intOpt` property, then greatly slows down with the `stringArray` property. Also, in the `td-json-enum` branch, I've added a JSON enum type to help with the type inference. It makes things faster but still sees a big slowdown with those same 2 properties. Steps to Reproduce: 1. Clone the public repo from GitHub: https://github.com/thoughtbot/Argo 2. Open the project in Xcode 3. Run the tests. Expected Results: The test suite should compile within seconds and the tests should run and pass. Actual Results: The tests suite takes a very long time to compile. So long that I typically give up and stop the build. Version: Xcode 6.0.1
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!