Compile Time Incredibly Slow

后端 未结 8 1169
执笔经年
执笔经年 2020-12-22 23:57

My project consists of ~350 Swift files and ~40 cocoa pod dependencies.

As soon as the entire project was migrated to Swift 3, build times have been <

8条回答
  •  醉话见心
    2020-12-23 00:15

    Also string concatenation seems to be incredible slow in Swift3/XCode8:

    item.text = item.text + " " + pickerText + " " + (attribute?.Prefix ?? "") + inputText + (attribute?.Suffix ?? "")
    

    ~ took 8-10 seconds to compile

    item.text = "\(item.text) \(pickerText) \(attribute?.Prefix ?? "")\(inputText)\(attribute?.Suffix ?? "")"
    

    ~ took 1,6 seconds to compile

    item.text = [item.text, " ", pickerText, " ", (attribute?.Prefix ?? ""), inputText, (attribute?.Suffix ?? "")].joined();
    

    ~ took 0,001 second to compile

提交回复
热议问题