Chrome Plans to Limit the Activity of Background Tabs to Improve Performance

INTERNET cj Times

Google Chrome

 

 

Google Chrome engineers are working on a throttling system that would impose a limitation on the number of JavaScript (timers) operations that unfocused background tabs can perform.

 

According to Google, this would reduce the CPU usage coming from Chrome's background tabs, indirectly improving the browser's performance and the device's battery life.

Google takes on overburdening, excessive JavaScript timers

This new mechanism is explained in a two-page document and discussed further on the Google Chrome discussions group.

The document refers to JavaScript timers, which are exactly what you think they are, countdown timers implemented in JavaScript code.

 

With the rise of real-time web-based applications, JavaScript timers have become indispensable, allowing developers to trigger actions at specific times or schedule recurring operations, such as checking for new messages in email inboxes and chat clients, refreshing pages automatically, and more.

 

Unfortunately, many web developers have abused this feature and overloaded pages with timers that often trigger and run seemingly non-stop.

According to Google, this has led to some situations where one Chrome background tab was consuming up to 20% of the device's memory.

Background tabs will work on a "time budget"

To fend off the abuse of JavaScript timers, Google engineers plan to limit the access of background tabs to Chrome's JavaScript processing engine.

 

The way they plan to do this is by using a "time budget" for each tab, which can exhaust if the background tab triggers too many timers. The proposed throttling mechanism, as described by Google engineer Alexander Timin, is as follows:

  •     Each WebView has a budget (in seconds) for running timers in background.
  •     A timer task is only allowed to run when the budget is non-negative.
  •     After a timer has executed, its run time is subtracted from the budget.
  •     The budget regenerates with time (at rate of 0.01 seconds per second).

According to Timin, the main motivation to implement such system is to counteract JavaScript ads and analytics scripts that are often the source of many of these timers.

Legitimate concern that this measure might break apps

Developers have voiced concern that this mechanism might ruin real-time applications such as Slack, Discord, and others, who rely on timers to power many of their features, such as notifications and operations that alter the tab's favicon to signal new content.

 

Anticipating criticism, Google engineers said they've tested the new throttling system on Gmail and saw no loss of functionality.

The browser vendor also said that pages that play audio would be exempted from the timer throttling mechanism, a decision they made to avoid breaking the service of YouTube, Soundcloud, Spotify, and other music streaming services, which users intentionally leave running in the browser's background.

 

This exemption also opens a hole, which advertisers and website owners could exploit, by playing a looped inaudible sound and running as many JavaScript timers as they wish.

 

Google plans to ship this feature for all six Blink platforms: Windows, Mac, Linux, Chrome OS, Android, and Android WebView.

 

lIKE ()orShare