[SR-11736] Type checking is unacceptably slow, and got significantly worse with Xcode 11 #54143
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
performance
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
macOS Catalina 10.15.1
Xcode 11.1
MacBook Pro 15 (2018), 2.9 GHz 6-Core Intel Core i9, 32GB of RAM
Additional Detail from JIRA
md5: 255a6b937472bfd319b643906829143f
Issue Description:
Xcode 11 / Swift 5.1 introduced significant increases in the time taken to type check Swift code. Even quite simple expressions can now take longer than 100ms.
This problem was first raised on twitter by my colleague David Rodrigues: https://twitter.com/dmcrodrigues/status/1192136776212713472
The example project attached (Type Checking Issues.zip) has a number of examples taken from a larger project where the number of "time to type-check" warnings has skyrocketed from 2 or 3 to 40 or 50 since we migrated to Xcode 11.
An example warning output is this
As you move the selection through these warnings, Xcode also seems to be continuously re-compiling the code (even though nothing has changed) and regenerating new type check time warnings as shown in this video:
XcodeTypeCheck.mov
Two of the worst examples are the following:
and this one:
These type checker performance degradations have also significantly increased overall build times, which have increased between 15-20% since we moved to Xcode 11.
Note: building the project using
xcodebuild -configuration Debug -sdk iphonesimulator
the type check times are not as bad, but still there.The text was updated successfully, but these errors were encountered: