Calendar.current.date(bySettingHour takes so long to compile

后端 未结 1 1667
情歌与酒
情歌与酒 2021-01-29 15:58

I have used Calendar.current.date(bySettingHour code for setting particular date. Problem is it takes so long to compile ~4 seconds

print(\"Time sec         


        
1条回答
  •  情深已故
    2021-01-29 16:14

    You can't test performance in a Playground, and most of all not compile performance. Playgrounds do a lot of extra work to display "(9999 times)" in the right-hand column. Playgrounds also don't really have a separate "compile" step that you can separate from execution. And they don't optimize the code. There's no part of performance that you can evaluate in a Playground.

    When I compile this with swiftc it takes less than half a second. It runs in less than a second.

    0 讨论(0)
提交回复
热议问题