Question

Can we reap the benefit of web workers, if we have single core machine? I have come across web workers are designed to work in multi-core processors environment.

Était-ce utile?

La solution

Multi-threading can still be a valuable organizational tool even when it is not a tool to increase performance.

Consider a long calculation that isn't easily broken up into small pieces. Running the calculation inside of a worker allows the operating system to perform scheduling for you. The process runs in the "background", the user interface stays responsive, and you don't have to rewrite your code into a bunch of setTimeout() and setInterval() calls.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top