javascript – What technique does this site use to consume all the machine's processing power?

Question:

This site: https://ffbeequip.com/builder.html has a system to create an automatic equipment build, it will test all possible equipment until reaching the conclusion of which one looks better on the character. There is an option to use more than 1 processor core, and when activated using all cores, the processing goes to 100% instantly, is there any native function in Chrome that allows you to manipulate the processor usage, for example to use its full capacity?

Answer:

JavaScript, by default, is single thread: it can run only one program on one CPU (core).

I believe that for this it would be necessary to use Web Workers: https://developer.mozilla.org/pt-BR/docs/Web/API/Web_Workers_API .

Web Workers are mechanisms that allow an operation of a given script to be executed in a different thread than the main thread of the Web application. Allowing that laborious calculations to be processed without blocking the main thread (usually associated with the interface).

Thus, it would be possible to use workers on separate cores, allowing up to 100% CPU capacity utilization.

https://www.html5rocks.com/en/tutorials/workers/basics/

Scroll to Top
AllEscort