3 ms·
Type checking in Swift is notoriously slow and picky. Things have improved over the years (considerably!), but the odd complicated generics usecase will either
by manmal 3y ago
Type checking in Swift is notoriously slow and picky. Things have improved over the years (considerably!), but the odd complicated generics usecase will either take a minute extra to compile, or throw a Segfault.
- jodrellblank 3y agoDoesn't the link go on to say it's not the type checker causing this? "I found a trace of the compiler kind of surprising; the time is not all being spent in the type checker, as you observed:" - 5th reply by scanon
- manmal 3y agoIt says "not all", which I interpret as "some of it is not spent in the type checker". I'm also not sure the times Xcode displays in the screenshot are bound to be accurate.
- stephencanon 3y agoInstruments is a sampling profiler; it's the ground truth w.r.t. where time is being spent.
- manmal 3y agoI don’t know about Instruments‘ implementation, but sampling profilers are not renowned for their accuracy.
- stephencanon 3y agoAll profiling techniques have their drawbacks, but for a quick "where is the time being spent" analysis at multiple-second granularity, you're solidly in the territory where sampling profilers work really well.
- manmal 3y agoThanks for this insight!