Async/await is strictly worse than green threads, except that the latter might require runtime and/or ABI changes that you cannot push out, whereas async is front-end sugar mostly hiding the fact that you're passing callbacks to enable "single-stack green threading." Am I wrong?
An async call chain has to cost more than a setjmp at the innermost call, though we're talking peanuts either way
-
-
I don't know which implementation of "async" you're talking about -- I don't mean JavaScript-style with closures and indirect jumps but e.g. Zig-style where you generate a struct corresponding to a function's stack frame.
-
But the big costs of stack-switching aren't swapping ~8 registers. They're things like cache misses on the parts of the stack you *don't* need to save (just used for regular computation) every time you switch to a new green thread. Explicit state machines reuse the regular stack.
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.