4 ms·
WebWorkers are testament to the lack of mutual exclusivity between event loops and threads. http://en.wikipedia.org/wiki/Web_worker http://en.wikipedia.org/wik
by pyrotechnick 14y ago
WebWorkers are testament to the lack of mutual exclusivity between event loops and threads.
http://en.wikipedia.org/wiki/Web_worker http://en.wikipedia.org/wiki/Web_worker
https://developer.mozilla.org/En/Using_web_workers https://developer.mozilla.org/En/Using_web_workers
Once you start doing any heavy lifting or large amounts of parallelizable tasks you will find yourself drifting towards the threading model from within your event loop.
- bascule 14y agoUnfortunately Node's implementation of web workers uses external processes and serializes all the data as JSON. This makes them considerably slower than Chrome's implementation of web workers, which use threads. In general if you're doing something compute-bound, Node's single threaded event loop isn't going to help you. Depending on your performance requirements you might take a look at LMAX and Disruptor. At the very least you could be writing Java instead of C++