Chrome JavaScript timer throttling: Google's tests show it saves up to 2 hours' battery life

I came across this article and thought it was worth sharing for all the aspiring (and current) web devs here!

“When enabled, wake-ups from DOM Timers are limited to one per minute in a page that has been hidden for five minutes,” Google’s Chromium developers note.

“We used Devtools to inspect the work done by popular sites in the background. We found that a lot of work was done from JavaScript timers. Furthermore, we found that the work done from these JavaScript timers was often not valuable to the user when the page was backgrounded (eg checking if scroll position changed, reporting logs, analyzing interactions with ads).”

“At the median, throttling JavaScript timers aggressively extends the battery life by almost two hours (28%) for a user with many background tabs, when the foreground tab is about:blank,” the Chromium team writes.

That’s a huge difference! I’d love to hear from any of you guys that have experience with Javascript DOM Timers and in what situations you use them.

Also, if you want to try it yourself:

To test the JavaScript timing throttling feature, users can download the current Chrome from the Canary developer channel and type into the address bar ‘chrome://flags’ and then either search ‘JavaScript’ or type in ‘chrome://flags/#intensive-wake-up-throttling’. This experiment setting will throttle JavaScript timers in the background.

1 Like