What’s the performance of `currentCoroutineContex...
# coroutines
n
What’s the performance of
currentCoroutineContext()
? I imagine it doesn’t suspend despite being
suspend
and should return immediately, just fetching some compiler generated field, no extra allocations. Is this right?
s
Yep, it’s pretty much going to resolve to a call to
Continuation.context
on the current continuation. The
suspend
modifier just makes sure that there is a current continuation. Nothing actually ends up suspending.
n
Nice, thanks a lot!