Coming from Node.JS, the event loop is well understood. Particularly that Promise callbacks operate
Coming from Node.JS, the event loop is well understood. Particularly that Promise callbacks operate on the microtask queue and I/O is not processed in between microtasks. Unless I've missed something in my searches, very little is described about the event loop in Workers and how/when the event loop processes other requests (does it use the "default" V8 event loop implementation, and how does that work?).
The reason I ask is is: how to break up long-running CPU-intensive calculations to allow other requests to be processed in between? E.g. calculating password hashes using
If the workers event loop is similar to Node.JS, I/O and other requests will not be processed between microtasks. So the async implementation would only be less efficient and not have the desired effect of breaking up yielding the CPU to other requests.
Can someone teach me how the Workers event loop is implemented and how to yield to other requests?
The reason I ask is is: how to break up long-running CPU-intensive calculations to allow other requests to be processed in between? E.g. calculating password hashes using
noble-hashes. That library provides an async implementation which just uses promise callbacks (microtask queue) to break up the calculation: https://github.com/paulmillr/noble-hashes/blob/ae060daa6252f3ff2aa2f84e887de0aab491281d/src/utils.ts#L103-L119.If the workers event loop is similar to Node.JS, I/O and other requests will not be processed between microtasks. So the async implementation would only be less efficient and not have the desired effect of breaking up yielding the CPU to other requests.
Can someone teach me how the Workers event loop is implemented and how to yield to other requests?

