web_worker
web_worker copied to clipboard
Reduce use of postmessage
- Wasm has the atomic wait and atomic notify functions, it should be possible for the workers to wait until woken up to reduce the use of
postmessage
calls. - Could it also be made possible to have
wasm-bindgen
as an optional dependency? We are working on a web game and consider using anmethyst or rather SPECS as our ECS. - Is the run_notify used in any way by rayon, or could this be omitted for simplicity?
I'll try to fork this when I get around to implementing our thread pool
The underlying WorkerPool
implementation does indeed use post_message
to submit work, however, when integrated with rayon
we only send one rayon executor task which is infinitely blocked. Anything executed in rayon uses in memory channels and does not involve post_message
.
The implementation in pool.rs
is indeed quite heavy and could be simplified to just one initial message. I had it fixed like this, but the code unfortunatelly got lost somewhere.