Why don't web workers use it anymore?

Web workers are a technology from which I tint from time to time, whether it's a blog topic or a mention in a presentation.

During a later presentation I attended, the speaker said about web workers:

I am not sure why they are no longer used.

I realized, thinking about it, that for a technology with such obvious advantages and using cases of using web workers, it seems that there was a rather slow or narrow adoption.

Is there any inherent problem with web workers that makes them less useful? I was just looking for the wrong places for examples of their use? Or is it that Javascript programmers are not particularly used at all to create multi-threaded applications.

+6
source share
4 answers

The main reasons why they are not used much (in my opinion):

  • Inertia. They are relatively new technologies, and people have not yet found the time to learn them. You went to talk about it, which means that you are ahead of the curve; there are many people who have not even heard the term "web worker", and even more so thought about its coding.

  • Browser compatible. Older browsers do not support them. Most people still need to support at least IE8 for their sites, so you cannot use technology like this yet.

  • Why bother? The only reason to use the new technology is to solve the problem or achieve something new. Most sites do not have a real need for web workers. Or even if they do, they do not see the need.

  • Not brilliant enough. The Internet is a very visual medium, and many of the new browser features over the past few years have been very visual. It's easy to convince someone to try a new feature if it looks good. Web workers are not completely visualized; benefits are abstract. Developers can get this, but for most companies, decisions about how to spend time and money improving a site are made by non-developers, which makes it difficult to browse the web.

+5
source

Lacking most of the APIs supported by workers, he used a utilizer to use them for many of my projects.

Firefox will not have Websocket support until v35, performance.now in v34, and there is no support date for IndexedDB. Chrome recently added TextEncoder / Decoder in v38 and cannot pass ImageData. Some functionality may be reinforced, but others may not or are especially difficult to get around this goal.

WebSockets are not complete.

+1
source

My opinion:

  • They work well only when you need a lot of computing. In other cases, you are wasting time sharing resources, merging.
  • Additional coding required.
  • for simple tasks, they do not give much benefit, and JS usually does not do a lot of calculations.
  • do not work in every browser, IE8, ie9 do not support it ( http://caniuse.com/webworkers )
  • No DOM access is operational.
  • Some people simply use setTimeout instead of setInterval, but there are not many threats, only one processor is running at the same time.
  • They do not work well, then there is only 1 processor. Edit: you benefit from running processes in the background.
  • sometimes it’s difficult to share resources, it takes too much time, and the end result is not good.

But when you need to do a lot of calculations or perform a heavy process in the background , and you can ignore old browsers, web workers work very well.

0
source

Typically, a settlement website is an intranet site. Most large companies use Microsoft products, and they use IE as a browser. It is not easy to get the latest version of IE, because an update can break many intranet websites. My company is currently using IE 9, and they plan to upgrade to IE 10 in 2 years .... I have many applications that can use web workers, but I can not, because I do not have IE 10 .. .

0
source

Source: https://habr.com/ru/post/956933/


All Articles