Swift’s native Clocks are very inefficient

Screenshot of Instruments showing the outline view for a Time Profile, expanded to show dozens of spurious, overhead functions taking up the vast majority of the runtime.

By which I mean, things like ContinuousClock and SuspendingClock. In absolute terms they don’t have much overhead – think sub-microsecond for most uses. Which makes them perfectly acceptable when they’re used sporadically (e.g. only a few times per second). However, if you need to deal with time and timing more frequently, their inefficiency can become… Read more