So doing something that takes 8s doesn't have to block the UI at all. The "without webworkers" version should be renamed to "Naively programmed version" or something.
So doing something that takes 8s doesn't have to block the UI at all. The "without webworkers" version should be renamed to "Naively programmed version" or something.
There aren't many operations in javascript which will block. The only real issue is that your javascript code executes in the same thread as UI. Which just means you need to think a bit harder about keeping it responsive.
"Start threads!" in programming is usually a lazy hack.
What's the benefit you get from programming like that?
Also, it's not faster, so what's the actual point?
The browser should use all CPU cores efficiently to make javascript fast. Exposing WebWorkers to javascript programmers IMHO is totally the wrong way to do that.
Edit: close. https://html.spec.whatwg.org/multipage/webappapis.html#timer...
"Timers can be nested; after five such nested timers, however, the interval is forced to be at least four milliseconds."