2 ms·
There's overhead to a process that doesn't exist with threads. You can definitely split your work across threads in JS using Workers, ServiceWorkers and the mai
by esprehn 5y ago
There's overhead to a process that doesn't exist with threads. You can definitely split your work across threads in JS using Workers, ServiceWorkers and the main thread. Most apps don't take advantage of this very well though.
Using a separate thread gets you the same GC benefits.
There have been some attempts to make it easier to use threads on the web like the excellent Comlink library:
https://github.com/GoogleChromeLabs/comlink https://github.com/GoogleChromeLabs/comlink