2 ms·
It's not the whole point, there's lots of other (albeit smaller) gains to be had once you have a strong async apparatus. The core of your async implementation
by nananana9 6mo ago
It's not the whole point, there's lots of other (albeit smaller) gains to be had once you have a strong async apparatus.
The core of your async implementation doesn't have to care about I/O - as long as it has a way to block/schedule fibers, it's easy to implement io_uring/IOCP based I/O on top of that - it's a matter of sticking a single IO poll in your main loop, and when you get a result, schedule the fiber that's waiting for it.
Another thing you get almost for free is an accurate Sleep(0.3) - your Sleep pushes the current fiber in a global vector with the time to be resumed, and you loop over that vector in your main loop.
We're writing a game engine so WaitForNextFrame() is another useful one - the implementation is literally pushing the current fiber to a vector and resuming it the next tick.