3

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:

So: is there a list of known code syntax / patterns to avoid?

Community
  • 1
  • 1
Chris Conover
  • 8,889
  • 5
  • 52
  • 68
  • 1
    Some useful discussion here: https://devforums.apple.com/thread/228267?start=0&tstart=0 – matt Jul 25 '14 at 00:31
  • Note that the two postings you cite are about two completely different things. One is the indexing crash-and-burn; the mere presence of certain code causes you to lose control of the computer. The other is just a slow compilation. – matt Jul 25 '14 at 00:34
  • I think this question has some potential. But you need to get rid of *"...is there a list of..."*. That's a reason to close, and its likely to keep the question from being re-opened. Then, ask a concise question. – jww Jul 29 '14 at 23:34
  • @jww: Thanks, but what would you suggest? I have tried multiple forms. – Chris Conover Jul 30 '14 at 01:39

0 Answers0