You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code demonstrates a massive performance bug in the constraint solver:
var px : Int = 0
var py : Int = 1
var sx : Int = 0
var sy : Int = 1
// SLOW:
let _ : Double = (px-sx)*(px-sx) + (py-sy)*(py-sy)
// FAST workaround:
let _ : Double = Double((px-sx)*(px-sx) + (py-sy)*(py-sy))
The text was updated successfully, but these errors were encountered:
Yes unfortunately there are many such cases where we go exponential, and often these are cases where things do not type check successfully. I did some work over the last year to try to help this, but it wasn't enabled because it didn't help cases where there were generic versions of the operators, and the standard library now has generic versions of many operators.
You can try to enable it locally with -Xfrontend -propagate-constraints.
It appears to help in this case.
The expectation is that we'll be getting back to doing more performance work and I'll try to get this enabled after ensuring that it doesn't regress any cases.
Environment
ToT swift compiler
Additional Detail from JIRA
md5: 14220d2507595e65cba8bce015bd322f
Issue Description:
The following code demonstrates a massive performance bug in the constraint solver:
The text was updated successfully, but these errors were encountered: