Shizam Shizam - 1 year ago 61
Swift Question

How to track down slow compiling Swift code?

Xcode has added a great feature to see your application compile in real time but how can you see compile durations for individual classes and then further see what code is causing the slow compile times?

This is helpful but only gets part way there.


Use xctool. When you compile your project on the command line it will emit the time taken to compile each file to the console. e.g:

✓ Compile MySwiftFile.swift (12067 ms)

Additionally, for Swift 1.2 at least there is a flag debug-time-function which can be passed to the Swift compiler to show you problematic functions.

Further discussion here