Chrome To Introduce Timer To Throttle Background Pages (ghacks.net)
Google plans to roll out a change in Chrome Stable soon that will have the browser throttle timers in background tabs to improve battery life and browsing performance. From a report: The motivation behind the chance is that some pages consume a lot of CPU when they are in the background. Google mentions JavaScript advertisements and analytics scripts explicitly but it is not limited to that. The core idea is to limit the processing power that background tabs get in Chrome once the feature lands. (1) Each WebView has a budget (in seconds) for running timers in background. (2) A timer task is only allowed to run when the budget is non-negative. (3) After a timer has executed, its run time is subtracted from the budget. (4) The budget regenerates with time (at rate of 0.01 seconds per second). (5) The only pages that appear to be exempt from the throttling are those that play audio.
I guess we'll be seeing a lot more pages that play audio soon.
The only pages that appear to be exempt from the throttling are those that play audio.
Cool, so now we'll have even more ads playing audio!
Then the bad guys will play silent audio to abuse the system...
There are two types of processing jobs: One is a fixed amount of work, the other is as much work as can be done. You only save battery power by throttling the latter. The fixed amount of work type of job is usually more efficiently executed at full speed. So this may backfire. And who believes this isn't Google throttling competitors' analytics scripts while not throttling their own?
Silent audio won't necessarily work, as browsers are already detecting whether a video's audio is silent. In Firefox 51, this video that has intermittent audio causes the speaker icon in the tab to blink on and off whenever the game plays a sound effect.
Page rank, etc. might influence timer thresholds.
Now that they are just willy-nilly deciding to change web standards, what is next?
Embrace/Extend/Extinguish anyone?
Almost all tab use is, unfortunately, a lazy substitute for bookmarking, of pages that don't need to update when not viewed.
Key words: "Almost all". I can think of a couple exceptions that aren't "a lazy substitute for bookmarking":
Great, now ever page with an advertisement on it will play some audio in order to get around the timers.
Can they stop those css pop up screens? You know the kind that darken your background and ask for your email address when browsing many sites? You are forced to try and look for the nearly invisible X to close them. Tons of mainstream sites do this and its annoying as hell.
Only the State obtains its revenue by coercion. - Murray Rothbard
...They want their Safari Power-Saver Feature from THREE YEARS AGO back.
And although I can't seem to find any web pages on it, Safari also pauses Tabs that are "in the background", too.
The problem is documents that run "as much work as can be done"-type tasks that don't benefit the user, such as sending a client-side real-time-bidding ad auction out to forty different ad networks. So perhaps the goal is to discourage documents from running "as much work as can be done"-type tasks at all without the user's consent.
The only pages that appear to be exempt from the throttling are those that play audio.
So pages that steal computing cycles will start playing inaudible sounds while they work. This will stop all the scripts except for those that really should be stopped, and annoy pet dogs around the world too.
First, they block flash by default (yeah, Flash sucks - But 90% of online games still use it, and I want them to work); Unity virtually never works in Chrome; and now Google wants to cripple the small number of games that follow their own damned guidelines by using pure JS/HTML5?
I wouldn't care quite so much if Mozilla didn't appear dead set on committing suicide, but at this rate, I'll be running Edge by the end of the year!
To block sponsor and mailing list pop-overs, just press Ctrl+W (Command-W on macOS).
does that mean I can keep 500 tabs open, instead of 50?
Genuinely curious, when do you think it's useful to run games in background tabs? And I thought they just added "click-to-flash", rather than preventing you from viewing flash content entirely, which seems totally reasonable. That's a decision that saves memory/energy with the option of still using flash, and anything that gets the abomination known as flash off the web sooner is a good thing.
"The slave who knows his master's will and does not get ready...will be be beaten with many blows."Luke 12:47-48
"exempt from the throttling are those that play audio." are the tabs that consume the most CPU and are most annoying. They should be throttled the most. Google people live in their own little bubble and have such little interaction with people outside of Google that they no longer understand users.
According to the article (yes, I RTFA), here's the criteria:
-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).
This suggests a few ways around this.
- Play a 0.1 second silent audio sample on page load, throwing the page into "non-throttle mode". ::90 second extended cut::
- If "playing audio" itself only keeps the page's budget from decaying for a short time, play a 0.1 second silent audio sample before every timer call.
- Change your timer code to record its own runtime and set the next refresh to (runtime(ms) * 10). Ie. if your tracker call took 310ms to execute, set the refresh to 3100ms, or 31 seconds. If nothing else this would force ad trackers to write some efficient code for once.
- "HEY WEB SURFER WE'D JUST LIKE TO TAKE THIS OPPORTUNITY TO PLAY YOU OUR AMAZING JINGLE AND YOU WON'T BELIEVE WHAT HAPPENS NEXT!"
I'm not exactly sure how to mitigate that. Silent audio detection? (solved by playing a 40khz tone that you won't hear but will drive your pets bonkers) Option to turn it off? (disables your music streaming app after a while) That option with whitelists? (manual intervention == annoying your customers)
I'll be honest, we're throwing science against the wall to see what sticks. -Cave Johnson
The only pages that appear to be exempt from the throttling are those that play audio.
So every page is now going to play a silent audio track in a loop in order to work around this limitation?
This is a common trick in iOS applications to prevent the system from backgrounding you when off-screen. It won't take long to migrate to the web . . .
https://chrome.google.com/webstore/detail/the-great-suspender/klbibkeccnjlkjkiokjodocebajanakg?hl=en
Automatically suspends unused tabs to free up system resources
Unload, park, suspend tabs to reduce memory footprint of chrome.
Tabs can auto-suspend after a configurable period of time or be suspended manually. Tabs can be whitelisted to avoid automatic suspension. Suspended tabs are retained after closing and reopening browser, preventing many tabs from all reloading after a restart. Very simple, intuitive interface.
The Great Suspender is a lightweight chrome extension to help reduce chrome's memory footprint for users that like to have too many tabs open at the same time. This extension will automagically unload each tab while retaining its favicon and title text. A tab can be restored by clicking anywhere on the page when it is needed. This reduces the number of dom elements on the page and ensures no memory leaks or excessive javascripts are running.
The only game you could be 'playing' in a background tab is one of those stupid cookie clicker clones. Frankly, the world would be better off if those were crippled.
to have a mainstream browser just be a browser?
I'm going to sound like an old man but there was a time when all Chrome was aiming for was to be fast and lean. And it was able to be that. Something changed and now Google wants to use it for more than that. Which is when these sorts of things always go to shit. We saw it with IE, which was always shit but it got even more shit to everyone's surprise. Firefox keeps going through cycles of shittiness. Ug.
What about background video? I often leave news, music or other similar content playing in a background tab.
when do you think it's useful to run games in background tabs
Two obvious situations come to mind. First, "Idle" games, where you basically just let it run in the background and check in on it once an hour. And second - Let's say I want to look something up (maybe a Wiki for the game itself) in another tab; online games typically do not react gracefully to losing their network connection, and I would be shocked if being throttled for more than 100-250ms per second wouldn't have almost the same effect.
anything that gets the abomination known as flash off the web sooner is a good thing.
If you don't want to run Flash - Then don't. My computer? Not yours to decide what runs on it.
when do you think it's useful to run games in background tabs?
When they're streamlined simulations of an RTS's tech tree. Click the cookie a few times and I'll explain.
It is always wrong (ok, 99.9% of the time wrong) to have more than one context/page/plug-in instance in the browser play audio at a time, whether the context is backgrounded or not.
From a user perspective, the result of multiple concurrent audio streams is garbled, unintelligible, dissonant sound.
So if you can save power by preventing that, do so.
Related case in point: When a browser re-starts after a crash, it often seems to start auto-playing a bunch of separate youtube videos (which had been paused or at-end-of-video) on backgrounded pages. Again, this is ALWAYS the wrong thing for the browser to do.
Where are we going and why are we in a handbasket?
Egads, what took so long? This should have been done YEARS ago.
But tabs I am not looking at, (by default) should use ZERO CPU. I get that I might launch several tabs quickly and want to allow them to load. So, allow some time for them to load, but then cut it to zero.
Give me the OPTION to change this behavior. Give me the OPTION to play music in background (either globally, or on a specific tab). And for gosh sake, SHOW ME how much CPU each tab is using (optionally). Then I will know to avoid the sites that are using my browser to bitcoin-mine.
Apple had to clamp down on iOS apps that were abusing the "background audio" flag. Too many apps just played silent audio. Now, playing silent audio will get the app bounced from the store.
Unfortunately, the web has no benevolent dictator vetting sites. OF COURSE "background audio" will be abused!
The idea is to limit the processing power that background tabs get.
Got it. Simple, succinct, perfect.
(1) Each WebView has a budget (in seconds) for running timers in background. (2) A timer task is only allowed to run when the budget is non-negative. (3) After a timer has executed, its run time is subtracted from the budget. (4) The budget regenerates with time (at rate of 0.01 seconds per second).
Of what interest is it to anybody that the pseudo-code for this is the above, vs some other slightly different variant of how to restrict allocated processing time? Users aren't going to care. And if developers try to somehow design around this level of detail, they'll break if the algorithm ever changes.
When I tell a friend I'll show up for dinner, I don't then explain that I'm going to do so by walking one foot at a time until I get to the dinner place, at which point I'll commence chewing and swallowing.
- First they ignore you, then they laugh at you, then ???, then profit.
The only pages that appear to be exempt from the throttling are those that play audio.
Dadgummnit! Those noisy ads that auto-play while I'm pre-loading news articles are the ones I want suppressed.
When I spawn a tab to pre-load a (quiet) article, I want it to load ASAP, not throttled.
"We reject as false the choice between our safety and our ideals." --The American President (20.1.2009)
If they are concerned about battery like, i don't figure they are talking about mobile devices, the browsers for which all already pause javascript execution as soon as the tab is backgrounded.
Tying this to audio only is a bad UI design. Otherwise we are going to be seeing a lot more audio applications.
This should not be arbitrarily set by Google. Instead, it should come up as a permissions pop-up like the location permissions...
For example, it could say... This application wishes to update in the background more frequently than the recommended levels. This may affect battery life. Do you approve" [Yes] [No]
Just use the Great Suspender. Google it - it's for Chrome.
The reason I dumped Firefox for Chrome about 2 years back, it was acting like Chrome does now. It's not "lightweight" at all whatsoever. I have 16GB of RAM, and it's not uncommon for me to see 4-5GB taken up by Chrome alone. Using the OneTab extension is a godsend, as soon as I click, I get at the very least 4GB of memory freed up.
What is it with modern browsers adding more and more shite as they progress? Firefox started off just the way Chrome did, and nowadays it comes complete with a kitchen sink and god knows what else. Chrome is doing the exact same thing. Things shouldn't be updated just for "the hell of it", browsers should not slow down over time, you'd think as time progresses they would become more efficient.... And all of this is with the Flash player completely disabled (worst software ever ever created in the history of computing).
I have several tabs open all day long in the background for time tracking.
They use setInterval for autosaving. As this is semi-important, I wouldn't want this tab to be throttled.
Will there be an easy to use UI for disabling this throttle on a per tab basis? Perhaps in the context menu?
This better bot affect idle clicker games on Kongregate, I always keep 1 or 2 running in a background tab.
Okay, but what does luck have to do with it?
#DeleteFacebook
No web page should do anything when you're not looking at it. Full stop. Pun intended.
For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
Weren't timers originally disabled for pages in the background? Whose stupid idea was it to enable them? I'd like to see background pages completely disabled - downloads are handled by a separate mechanism anyway, so if you start a download and then go to another page, who cares?
"Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
Gee, I dunno, apparently not everyone is stuck in the 90s.
Perhaps phones should fuck off and stop ruining desktop software.
This stupid shit already exists to an extent and now they are going even more retarded in to this idea.
Maybe add this as an OPTION so I can never have it enabled.
Here's hoping the way around it won't get censored as well for stupid phone kiddies.
You can use event listener timers with postMessage instead. Even in Chrome this method is faster than native timers. MUCH faster. And that's with the tab visible!
Have some awful code
Try this with both the tab visible and not.
let's hope this excludes tabs where the mic or camera is being shard
1. Skip "CPU Budget" stuff
Just have a throttle of 10 or 100 or 1000 script actions per second, set well below browser lockup speed. To hell with reviews your browser is 0.028% slower than IE or Edge or Opera, running balls out locked up.
ATTN REVIEWERS OF BROWSERS: When you review for script speed, not caring about lockup, you are full of fail. This is all your fault.
2. I don't care what standard allows popups -- get rid of them.
3. I don't care what standard allows message boxes -- get rid of them.
4. I don't care what standard allows music or video autoplay -- have an all off button at the tab level. Let people set it permanently "for just this site."
5. Investigate why editing is slow and stuttered on Slashdot text entry for a message like this with Chrome on a S6. Whose crappy, chatty script implementation is calculating PI to a million digits between each letter?
(-1: Post disagrees with my already-settled worldview) is not a valid mod option.
>"Google plans to roll out a change in Chrome Stable soon that will have the browser throttle timers in background tabs to improve battery life and browsing performance."
It also kills remote access and thin clients. I have been screaming about this for years. And it shouldn't just be for background tabs, it should be for foreground ones too... if you are idle or the window doesn't have focus, there should be a way to throttle the hell out of the thing! Timers, animation, mouse polling, useless refreshing, so many things are conspiring to suck systems dry. Please, Mozilla, Firefox needs this too, ASAP!
At work we use thin clients and a single site we must use just revamped their site and now is consuming about 1000% more CPU than it used to... and it does it all day long, continuously. Yes, it is bad programming, but it is not like we end-users have much of any control over it. We need options to control this on the CLIENT SIDE. I ask users now to PLEASE close that tab/site when not using it, but many have to use it all day long or just don't care.... it ultimately affects us all.
Seems like we keep "reinventing" OS mechanisms inside the browser...
>(5) The only pages that appear to be exempt from the throttling are those that play audio.
What could possibly go wrong?
Nice Idea, bad solution.
"The budget regenerates with time (at rate of 0.01 seconds per second)."
So clearly when you have 100 tabs the compound budget regenerates at 100 * 0.01 second per second == 1 second per second. Or in other words 100 tabs in the background will still use all your CPU.
Also the tab I backgrounded last week cleary does not need to run timers as often (if at all, WTF is it still running?) as the page I backgrounded a minute ago. Clearly the regeneration rates should be flexible and age. Should be configurable globally and on a tab-by-tab level.
Personally the first thing I would LOVE to see is a "stop timer" option in the tabs menu and an indicator which tab consumes all the cpu. Give me manual controll now and do the automatic later. A long time ago pressing "ESC" used to stop a page from playing anim-GIFs and such. Why not bring this back to stop timers on the current page?
It is always wrong (ok, 99.9% of the time wrong) to have more than one context/page/plug-in instance in the browser play audio at a time
Are you sure about that? I count on my mail tab to ding when I get mail, my voice tab to ring when a call is incoming
If you get more than an average of 3.6 seconds of notification sounds per hour, then "99.9% of the time" they're not being played.