I've just had a look at Swift concurrency: Behind the scenes - WWDC21 - Videos - Apple Developer and after reading about the mechanism for continuation, i've got a question :
From what in understood (things are still a bit blurry, i may be confused) :
-
GCD works with thread context switching, which IIRC, push & pop thread contexts to and from the heap whenever a switch occurs.
-
async/await working with continuations also saves data to & from the heap (into the thread stack) at every suspension points.
My question is this : what makes the second mechanism inherently more efficient ?