Open swift-ci opened 4 years ago
@swift-ci create
Comment by DeskA (JIRA)
The cause of this seems to be that BooleanLiteralType is reassignable, so for the odd chance that someone does that, swift is incredibly slow.
I know that swift is a minefield of performance issues and slow type checking, but it would be nice to fix this and hsve a compiler shortcut
Environment
Swift 5.3Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, TypeChecker | |Assignee | None | |Priority | Medium | md5: db9c4c36968f95770af1e55b5bdecdbcIssue Description:
```
public override func hasItems(in: Store) -> Bool {
guard let items = store.storage?.items else { return false }
let hasNoItems: Bool = items.isEmpty
return hasNoItems == false
}
```
This takes 400ms to type-check.
```
public override func hasItems(in: Store) -> Bool {
guard let items = store.storage?.items else { return false }
return !items.isEmpty
}
```
This takes less than 10ms to type-check.
Boolean comparisons are extremely slow when compiling swift. It's well known that swift is a slow language, but this seems extreme.