Rejoice, Chrome users! With Chrome 57, released this week, your laptop might soon get more than three hours of battery life when you have multiple tabs open.
In September last year, the Chromium team said changes were coming to Chrome’s handling of background tabs, but the changes have landed in the stable branch of Chrome a little sooner than expected. Basically, from now on, background tabs will be limited to an average CPU load of just 1 percent on a single core.
Chrome 57’s actual mechanism for background tab throttling is a little more complex. After 10 seconds of being in the background (i.e. not in focus), each tab has a budget (in seconds) for how much CPU wall time it can use. (Wall time is the actual real-world time it takes for a process to start and complete.) The background tab is only allowed to use the CPU if it hasn’t consumed its entire budget. Here’s the kicker: the budget constantly regenerates, but only at a rate of 0.01 seconds per second.
For now there are a few caveats, too. Some background tabs are exempt from throttling, including tabs that are playing music and tabs that have a real-time connection to a remote server using WebRTC or WebSockets. Google also says the regeneration rate could be tweaked as more data is gathered about how throttled apps behave.
The Chromium team says it’s seeing “25 percent fewer busy background tabs” with the new throttling mechanism in place. Anecdotally, after updating to Chrome 57 and with about 20 tabs open, my laptop feels a lot more responsive. Switching between tabs feels a little quicker, and there seems to be less input lag when typing or otherwise interacting with the browser. I haven’t tested battery life yet, but it wouldn’t surprise me if there’s a significant improvement.
Longterm, Google has even more aggressive goals for background tab behaviour in Chrome, eventually resulting in complete background tab suspension by 2020. Later in 2017, on mobile platforms, background tab updates will be immediately suspended (right now they’re allowed to keep running for five minutes). Sometime in 2018, WebWorkers may be throttled as well, pending further data gathering. After that, all background tabs will be suspended immediately unless the site explicitly opts out. And then, by 2020, that opt-out will be removed, Chrome will be able to aggressively optimise and purge background tab memory usage, and we’ll all live in some kind of three-day battery life nirvana.
To update to Chrome 57, visit Settings and then About. If you haven’t already been automatically updated, it’ll download.