i have swift spritekit project 25 smallish files. time compile project 30-45 seconds! it's pure swift no objc.
i've watched compile in report navigator try find single file that's taking time. but, it's not single file. it's last file in list seems take time. file can different between compiles , still takes time.
the step right after last file merge xxx.swiftmodule, happens quickly, i'm not sure if because comes right after slowness might related.
i've searched , tried various approaches find culprit. read post: why swift compile time slow? , tried approaches. i've done command line build using ctrl-\, not show useful information slowness.
i've gone through project looking places type inference might getting tripped up, haven't found (and really, if case, i'd expect single file culprit).
does have other suggestions tracking down? coming objective-c project compiles instantly, driving me crazy.
edit worked on bit more , including screen shot of build output, noting slowness happens. thing is, if comment out code in slow file, file before in list becomes slow 1 (where fine before). if comment code out, 1 before becomes slow one, etc.

after more digging , debugging, found problem. turns out is type inference, other posts have suggested. part of problem did not notice build output in report navigator shows arrow files still compiling , checkmark done (my color blindness played role). thought finished compiling when 1 not.
in case, read article here: gm release of xcode 6 compile , did command line build of entire project, showed me file issue. then, using ctrl-\ approach noted above, found culprit.
it turns out line issue:
ourwindowcopy.position = cgpoint(x: ((26.5 + thexoffset) * self.multiplierwidth) + (4.0 * cgfloat(randomrow) * 2.0 * self.multiplierwidth), y: ((41.0 + theyoffset) * self.multiplierheight) + (5.75 * cgfloat(randomcolumn) * 2.0 * self.multiplierheight)) i know seems mess - playing around bunch of different options on , hadn't yet gone simplify. replaced (and of course replace literals further):
let floatrandomrow = cgfloat(randomrow) let floatrandomcol = cgfloat(randomcolumn) let pointx: cgfloat = ((26.5 + thexoffset) * self.multiplierwidth) + (4.0 * floatrandomrow * 2.0 * self.multiplierwidth) let pointy: cgfloat = ((41.0 + theyoffset) * self.multiplierheight) + (5.75 * floatrandomcol * 2.0 * self.multiplierheight) ourwindowcopy.position = cgpoint(x: pointx, y: pointy) now compile speed fast!
i'm not sure there's new information here, wanted close out solution in case runs across it.
Comments
Post a Comment