SE-0300: Continuations for interfacing async tasks with synchronous code

The overhead is that the checked API needs to use a class to implement the "dropped without resumption" (this implies ARC traffic for counting that reference as well), as well as the resume calls needing to perform an atomic CAS whenever they're called: https://github.com/apple/swift/blob/main/stdlib/public/Concurrency/CheckedContinuation.swift#L63

The unsafe API is boils down to a raw pointer to the task object.

Since some continuation heavy APIs are likely to try to optimize away any un-necessary atomic operations we feel it reasonable to provide an API that does not do this (both in terms of storage and the operation itself).

// edit: more precise wording about the overhead

1 Like