4 ms·
Pending async waits have stacks to preserve too
by novocaine 6y ago
Pending async waits have stacks to preserve too
- Yoric 6y agoIn some languges, that's true. In Rust, however, that pseudo-stack is typically tiny.
- steveklabnik 6y agoThe difference, at least in the way this is built in Rust, is that when you create a task, you get a single allocation that's exactly sized. There's no resizing, which means that you aren't getting stacks that are too big or too small, with all of the other runtime shenanigans that that entails.
- varajelle 6y agoThat said, the future has the size of the biggest state that need to be kept across await. The future might be slightly oversized, but still order of magnitude smaller than a perfectly sized stack.