Answer the question
In order to leave comments, you need to log in
How to limit CPU power consumption for executing JS code in Chrome?
Hello.
I study array sorting algorithms, write JS code, run it in Chrome under Win 10. There are no problems with small arrays, but as soon as I try to sort large ones, problems begin. Chrome takes everything from life and clogs the processor at 100%, but I would like to perform some more tasks in parallel, it is relatively comfortable while the array is being sorted. Actually, the question is how not to let the executing JS code (in my case, sorting the array) consume 100% of the processor, but to specify that it uses, say, 50%? Thank you.
Answer the question
In order to leave comments, you need to log in
The question is not in eating the CPU (it cannot be limited in any way in the browser, you can only reduce the number of operations per unit of time), but in blocking the main thread. Solution - Web Workers
Do it in a node, a node in a virtual machine, you can set as much as you need there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question