Open rdw-software opened 1 year ago
Possibly related: #152
One question worth considering is, if coroutines can be made more transparent and they're used for async I/O in the runtime, how does that compare to the current approach of standardized (local) event handlers? Will there still be need for interop
and C++ queues to deal with uWebSockets or GLFW events? For performance reasons these have to be deferred. Do coroutines help?
Edit: if they can't solve these problems, then it would lead to even more inconsistency to actually use them for async I/O. In that case, it might be better to add proper events (via the global registry) for everything, even libuv callbacks, instead of coroutines?
Also, how do they compare to C++ fibers? I've never looked into them and I'd expect they aren't it, but it's worth exploring the idea.
One of the main issues I've had with using coroutines for async I/O is the complete lack of transparency. This could be fixed by adding events whenever they change states; however in scenarios where many coroutines are spawned this might cause performance issues. I had an old prototype somewhere that did just that, by replacing the entire
coroutine
library on-the-fly (only for debugging). With a standardized event registry this might yet be a viable approach. I don't think it can obsolete callbacks entirely, but it might help?Requires #55 (since there isn't any special support for events in the runtime currently).