Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> If you're having problems with speed, I'd recommend profiling your build, it's possible there are a handful of functions that are taking most of the build time.

How does one do that? I hit this problem a lot. (I’ve since learned to use lots of explicit casts to make it less bad.)



I can't remember exactly, it's been a year since I last did this. I believe there's a setting for the threshold at which this should be logged, so you could set it to log any expression that takes more than 100ms to type-check. By default I think it just times out at 10 seconds or something.


I looked into it, and found that you can add these "OTHER_SWIFT_FLAGS" to your project:

OTHER_SWIFT_FLAGS = -Xfrontend -debug-time-expression-type-checking -Xfrontend -debug-time-function-bodies

There's also this great WWDC session on build parallelization:

https://developer.apple.com/wwdc22/110364




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: