3 ms·
> Some languages have async/await sugar built around futures instead; this is a mistake and it's less efficient too. Could you elaborate on that?
by Zababa 4y ago
> Some languages have async/await sugar built around futures instead; this is a mistake and it's less efficient too.
Could you elaborate on that?
- astrange 4y ago- The syntax isn't as good. (this is more like a lot of minor annoyances than one big point, but you can see it discussed in the Swift pitches) - It's not visible to compiler optimizations so it can't optimize coroutines. - It's not visible to the OS scheduler, or a green thread scheduler. Any pattern where you start an async task and then later wait on it leads to priority inversions, because until your more important thread is waiting on it, the scheduler doesn't know it's going to, so it can't inherit the priority.
- Zababa 4y agoThank you for the explanation.