3 ms·
This does not use async/await "colored" functions: > This gives you the freedom to write simple blocking code, but the runtime is going to make sure it actuall
by nerdponx 4y ago
This does not use async/await "colored" functions:
> This gives you the freedom to write simple blocking code, but the runtime is going to make sure it actually never blocks a thread if waiting on I/O.
It's more like Go or Ruby non-blocking fibers, where I/O primitives implicitly and automatically "yield" control to the event loop.
I don't know how that works, but I would guess that there's a big lookup table of such operations in the interpreter/compiler.
- spinningslate 4y ago> This does not use async/await "colored" functions: Thanks, yes, that's my point. I'm not convinced by async/await as a technique. I'm finding the "non-blocking fibers" approach much preferable in practice.
- jayd16 4y agoThey both have their own place. If you're writing code where you care about thread identity, like a GUI code or using a native thread for various reasons and you want specific control, async/await gives you that control. If you don't care about thread identity and just care about pure throughput, pre-emptive is less cognitive load up until the work stealing starts to matter.