Notes on "Why Swift's type checker is so slow"
Notes on Why Swift's type checker is so slow
let address = "127.0.0.1"
let username = "steve"
let password = "1234"
let channel = 11
let url = "http://" + username
+ ":" + password
+ "@" + address
+ "/api/" + channel
+ "/picture"
print(url)
Swift 6 spends 42 seconds on these 12 lines
Ouch.
The Swift standard library has 17 overloads of + and 9 types adopting the ExpressibleByStringLiteral Protocol. This leads to an exponential combination of types and operators for the constraint solver to try.
No matter how many combinations the solver tries, none of them resolve this error.
let result: Double = -(1 + 1) + -(1 + 1) - 1
Swift 6 takes 6.2 seconds to compile this one line