5 ms·
In this case, Swift is being, lets say suboptimal, compiling an 8MB array of integers. It's worth mentioning another, more common, cause. There can be computat
by jws 3y ago
In this case, Swift is being, lets say suboptimal, compiling an 8MB array of integers.
It's worth mentioning another, more common, cause. There can be computational cost explosion when Swift resolves the types for function calls (and operators). You notice it when you get the "too complex" error, but you may be tolerating slow compiles which are just slightly less than too complex. A few explicit type annotations in these situations can do wonders for speeding your development cycle.
Edit: redact
I unfortunately can't tell you how to find these. Maybe a "give it a go with reduced complexity limit" compiler flag would help find them.
Edit: Add see reply below for answer.
- stephencanon 3y agoAs a sibling mentioned, -warn-long-function-bodies=<limit-ms> and -warn-long-expression-type-checking=<limit-ms> can flag these for you. That said, we should also get these to be fast enough that we have to introduce new flags that take µs instead of ms.