[SR-13799] Boolean Comparison Extremely Slow #56196
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
Environment
Swift 5.3
Additional Detail from JIRA
md5: db9c4c36968f95770af1e55b5bdecdbc
Issue 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.
The text was updated successfully, but these errors were encountered: