XCode 6, Beta 4
I keep running into new cases where the swift compiler consumes all CPU and RAM resources. Is there a list of known cases / code patterns to avoid?
So far, I have lost far too much time to tracking down these statements:
Longer arithmetic expressions that use array operators
let f = n1*n3*ttt + (n1*n3*ttt / n1*n2*t*t) + bx[1] // (rapid memory leak, OS freezes)
Note that long expressions that do not use the array operators do not suffer the same plight, this works just fine:
let e = n1*n3*ttt + (n1*n3*ttt / n1*n2*t*t) + n1*n2*t*t + n2*n3*t + n2*bx3 + 2.0 * n3
Assignment from ternary operators and/or arithmetic expressions:
var mx = useCurrent // (SourceKit process consumes available CPU capacity 500%+) ? (nextPt.x - curPt.x) * 0.5 + (curPt.x - prevPt.x)*0.5 : (nextPt.x - curPt.x) * 0.5
I have found this, but no comprehensive list:
- Swift: unwrapping cause swift compile slowly (this one may actually be the arithmetic, like above, and not the unwrapping)
So: is there a list of known code syntax / patterns to avoid?