Chrome JavaScript throttling experiment improves Battery significantly
Web browsers uses a lot of battery when they are run on mobile devices such as laptops. While it helps to use content blockers and other extensions to remove or block elements that may draw additional power, it is still problematic from a user perspective.
Google has run experiments in the past couple of months in its Chrome web browser to find out if the throttling of JavaScript in background tabs has an effect on the battery usage of the web browser.
Chromium engineers decided to analyze "the work done by popular sites in the background" and determined that "a lot of work was done from JavaScript timers"at were not "valuable to the user" often.
The idea was born to reduce the number of wake ups from JavaScript timers in background tabs in the web browser to find out if that would improve battery life.
Currently, JavaScript wake ups are limited to 1 wake up per second in stable versions of the Chrome web browser.
Google ran several experiments to determine if the throttling of JavaScript wake ups would improve battery life. Here are the results:
Experiment 1: 36 popular sites in background tabs, about:blank in foreground.
- Current status: Median time to discharge 6.4 hours
- Throttled status: Median time to discharge 8.2 hours
Experiment 2: 36 background tabs, YouTube in foreground
- Current status: Median time to discharge 4.7 hours
- Throttled status: Median time to discharge 5.3 hours
A new Chrome experimental flag is available to enable the feature in development versions of the Chrome we browser (Canary).
- Name: Throttle Javascript timers in background.
- Description: When enabled, wake ups from DOM Timers are limited to 1 per minute in a page that has been hidden for 5 minutes.
Here is how to enable the experiment:
- Load chrome://flags in the web browser's address bar.
- Search for Throttle Javascript timers in background.
- Set the flag to Enabled.
- Restart the browser.
Google Chrome will limit JavaScript timers of background pages after the restart automatically; this is applied to pages that have been in the background for at least five minutes.
The feature may be introduced in Chrome 86 on the desktop (currently Canary).
Google plans to introduce an Enterprise policy to disable the intervention. The idea behind the policy is to provide administrators with an option to turn the functionality off if they notice that it breaks functionality.
Tests will be run to find out if the feature will break certain features on sites.
Other Chromium-based browsers such as Microsoft Edge, Brave, Vivaldi, or Opera, will get the feature as well unless the developers of the browsers deactivate it actively. It is very likely that Mozilla will implement this also in the Firefox web browser in the future.
Battery life improvements are always welcome, especially if a small change extends the battery life by a lot.
Now You:Â Is battery life of concern to you?
Google’s core design decisions prioritizing them running unsolicited code on your system without any way to be stopped by the user are the reason why no fork will ever be able to tame the dataleaking monster chrome will always be.
Too many sites enforce js use these days.
It’s one thing if i have a userscript parsing a website in the background, a completely different one if miners, data or otherwise, merrily waste cpu while exposing your underlying os to all the wonderful ways you can get owned just by opening any given damn website.
@tskata
> Google’s core design decisions prioritizing them running unsolicited code on your system without any way to be stopped by the user are the reason why no fork will ever be able to tame the dataleaking monster chrome will always be.
But “ungoogled” versions of Chromium do exist already:
https://github.com/Eloston/ungoogled-chromium
https://chromium.woolyss.com/
Brave has also taken care of the phoning home anti-features:
https://github.com/brave/brave-browser/wiki/Deviations-from-Chromium-(features-we-disable-or-remove)
There are definitely builds of Chromium where the browser does not phone home to Google, it’s just crucial not to use Google Chrome, because that one obviously will phone home to the mothership.
> Too many sites enforce js use these days.
Well, much of the modern web uses JavaScript, and therefore all browsers (not just the Chromium-based ones) have it enabled by default. Disabling it by default is a bad idea since that will inevitably break most websites, but if you want to block if selectively, then I’d recommend using uMatrix.
Freezing tabs anyone?
Why give them minutes to run when not looked at at all?
What’s the difference between this and discarding tabs? Seems like it sounds the same if you’re already using an extension to discard tabs.
You can switch back to the tabs much faster, since the DOM is still loaded.
> It is very likely that Mozilla will implement this also in the Firefox web browser in the future.
JavaScript trottling in background tabs is implemented in Firefox since at least two years, maybe more.
I blocked JavaScript through site settings “chrome://settings/content/javascript” and i can feel the difference. Even this site loads faster and the content doesn’t change.
Though i have to manually allow JavaScript on other sites for them to work correctly.
The best way to save battery is using Windows built-in resource management, and setting CPU limit to something like 50% speed – this will effectively limit the multiplier (out of base maximum clock, not counting Turbo) to only go halfway, regardless of workload.
i.imgur.com/U61Zeqz.png