3 ms·
Is this demo supposed to highlight the strength of web worker? It runs 300-400ms slower on web worker.
by didip 10y ago
Is this demo supposed to highlight the strength of web worker? It runs 300-400ms slower on web worker.
- spiderfarmer 10y agoYes. And it succeeds. The browser is responsive during the web worker method and is beachballing without.
- sumnulu 10y ago"As you can see, without Web Worker, your browser maybe able to sort the 50K Array but you can't work with your browser while sorting and also your browser won't render anything until sorting ends, that's why you can't see the animated progress bar in the page."
- Jtsummers 10y agoWeb workers offer several benefits: 1) UI isn't locked up by long running tasks; 2) Potential performance improvement by running multiple processes at once (parallelization); 3) Potential design improvements by decomposing the problem into a CSP-like design (which may or may not relate back to (2)). (2) is really not the purpose though, it's just a potential benefit. golang, for instance, doesn't give us inherently better performance by use of goroutines. What it gives us is better design and separation of execution blocks so that they can run concurrently. Better performance is just a perk when things can run in parallel.