Can you have Javascript running on the browser at full performance even when I'm on a different tab?

Viewed 490

There are many instances where I leave a looped async function running on a chrome tab (for testing) but whenever I leave the lab, Chrome seems to significantly lessen the speed at which js runs on that tab. Is there any way to have full cpu power for running javascript on a different tab than that I am currently on?

For example, when I'm running a js test file on tab 1 with localhost:3000 but I go off another tab to do something else for a while. When I come back to tab 1, I see minimal progress.

1 Answers

https://developers.google.com/web/updates/2017/03/background_tabs

Background tabs can have a dramatic negative effect on browser performance, especially on battery life. To mitigate this, Chrome has been placing various restrictions on background tabs for the last several years.

...

Chrome provides the --disable-background-timer-throttling flag for use cases like running test suites and other user-sanctioned heavy computations.

So basically just launch chrome with the --disable-background-timer-throttling and you should be good to go

Related