Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Chrome The Internet

Chrome To Introduce Timer To Throttle Background Pages (ghacks.net) 122

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.
This discussion has been archived. No new comments can be posted.

Chrome To Introduce Timer To Throttle Background Pages

Comments Filter:
  • by Anonymous Coward on Wednesday January 25, 2017 @12:24PM (#53735993)

    I guess we'll be seeing a lot more pages that play audio soon.

    • by arth1 ( 260657 )

      Indeed.

      Why not have a checkbox on every tab that defaults to off, and which dictates whether the page updates at all when the tab is inactive?
      Almost all tab use is, unfortunately, a lazy substitute for bookmarking, of pages that don't need to update when not viewed.

      • 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":

        • I'm opening a bunch of documents in the background while I read a different document in the foreground on a computer that's not quite the fastest, and I'm reading the present document to give the browser time to load and render the other documents. These other documents need CPU time so that they aren't blank once I get around to them. Using bookmarks instead would produce a blank screen for several s
        • by arth1 ( 260657 )

          Key words: "Almost all". I can think of a couple exceptions that aren't "a lazy substitute for bookmarking":

          And that's where it would come in handy to have a checkbox, which would allow javascript and refreshes for that URL even when in the background. It would be a one-time switch flip for the sites where it's needed.

        • Tabs are like the piles of papers on your desk. Someone may point to the desk and claim it is inefficient, just file everything into properly labeled folders and put them away when you are done. But in reality it doesn't happen. You're working on one thing and then someone walks by and drops another project on your desk, asks you a question that you have to research before the person leaves, or you get an email that says "please finish filling out form XYZ by the end of the day". After a few iterations

      • by Anonymous Coward

        "Almost all tab use is, unfortunately, a lazy substitute for bookmarking, of pages that don't need to update when not viewed."

        Speak for yourself. Code reviews - one tab per file, close each tab as the file is reviewed = more efficient. Evaluating product pricing across shop sites - more efficient to keep each shop in a tab and flip between them. Research - each link in a wikipedia page can be opened in a tab and read in sequence.

        • by arth1 ( 260657 )

          Speak for yourself. Code reviews - one tab per file, close each tab as the file is reviewed = more efficient. Evaluating product pricing across shop sites - more efficient to keep each shop in a tab and flip between them. Research - each link in a wikipedia page can be opened in a tab and read in sequence.

          None of those scenarios seem to me to require background updates of the pages after they have been rendered once?

      • by Anonymous Coward

        Indeed.

        Why not have a checkbox on every tab that defaults to off, and which dictates whether the page updates at all when the tab is inactive?
        Almost all tab use is, unfortunately, a lazy substitute for bookmarking, of pages that don't need to update when not viewed.

        No.
        Bookmarks do not (and are not meant to) keep track of what I'm doing on a page. If I read half an article, switch tabs, then switch back, I'm right at the same place I left off. If I had to log into a site, I'm still logged in. If I've typed in part of a reply or comment on a site like slashdot, what I've typed is still there.
        Bookmarks do not preserve the state of the page. That's not what they're for.

        Put another way, tabs are primarily just a replacement for having multiple individual browser windows op

      • Indeed.

        Why not have a checkbox on every tab that defaults to off, and which dictates whether the page updates at all when the tab is inactive? Almost all tab use is, unfortunately, a lazy substitute for bookmarking, of pages that don't need to update when not viewed.

        You're an idiot to assume that your use case is also everyone else's use case. Or just an arrogant ass. Or both.

        I use multiple tabs when doing Internet searches. I always right-click links and select Open Link in New Tab. That way, I can close an irrelevant new tab without losing track of my search, and without having to backtrack to the correct page in the history. I can also leave a slow-loading new tab alone while I look at another tab. Or even right-click > Open on 2 or 3 links in a row so they ca

        • by arth1 ( 260657 )

          You're an idiot to assume that your use case is also everyone else's use case. Or just an arrogant ass. Or both.

          Pot, meet kettle.

          I use multiple tabs when doing Internet searches. I always right-click links and select Open Link in New Tab.

          So do I. As someone recently said, "you're an idiot to assume".

          How would that use case be negatively affected by preventing javascripts and reloads? Unless you use a search engine that redirects all your windows to their page so they can track your search results, I don't see a negative effect if the background pages stop updating after the initial rendering for as long as they stay in the background.
          And even then, all that is needed is a timer. Stop updating after having been in the b

      • by Anonymous Coward

        Nah, almost all tab use is a necessary work around to the overall shitty design of websites. The core problem being that page navigation is _slow_ especially with advert, analytics, shitty JS frameworks and otherwise junk ridden modern websites. If you go to a site, such as a news site, and want to visit multiple sub pages the best way to avoid this slowness is to open the links in the tabs and let them load "in parallel" vs navigating to one, then navigating back to the main page, then navigating to the ne

    • by GuB-42 ( 2483988 )

      I am not sure there really is a point trying to circumvent this limitation.
      There is no point in showing ads and monitoring background pages, and developers probably don't mind being throttled in this case. In fact, they probably want this behavior but are too lazy to check whether or not the page is actually visible before running their scripts at full speed.

    • I guess we'll be seeing a lot more pages that play audio soon.

      Why? What's the point? There's no benefit to chewing up the end user's CPU for an ad they aren't actively watching.

      Advertising companies are stupid for the most part, not malicious. Web designers also are stupid for not testing things like CPU load on their scripts. There's no point in circumventing the restriction unless you're mining bitcoins in a tab, in which case the user likely has bigger problems.

  • 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?

    • by tepples ( 727027 )

      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.

  • Page rank, etc. might influence timer thresholds.
  • Great, now ever page with an advertisement on it will play some audio in order to get around the timers.

    • Chrome displays an icon in tabs that play audio, you can click it to mute the tab. Not a big problem.
      • by Altrag ( 195300 )

        Until every page does it and you have to interrupt your flow in order to move your mouse up and click the tiny icon after every single tab load. Plus the wasted bandwidth downloading a bunch of audio that you don't want and are just going to disable immediately anyway.

        And then add on the fact that unless all browsers implement similar features, anyone who uses not-Chrome will be at even more of a disadvantage.

        I don't know what the solution here is. They obviously don't want to prevent people who listen to

  • by ArchieBunker ( 132337 ) on Wednesday January 25, 2017 @12:48PM (#53736243)

    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.

  • ...They want their Safari Power-Saver [youtube.com] 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.
    • Re: (Score:2, Informative)

      by Anonymous Coward

      Safari purges tabs in the background all the time saving enormous amounts of processing, yet it reloads them far too frequently as well wasting even more.

      • by aurum42 ( 712010 )
        I believe the "tab purging" only happens on iOS, not on MacOS. However, as the OP notes, Safari has had the timer throttling on background tabs for years.
    • This is common sense. If the page is not visible, then it should NOT do anything. If it's still hogging the cpu when I can't see it then that is lazy ass programming by a wannabe coder. The timer solution idea has been used in many applications and systems in the past, though not exactly the same way. It's hardly a new groundbreaking concept, it's quite like dynamic priorities in unix systems. Better to use have the headline read "Chrome throttles cpu usage of background tabs, but still is unable to co

      • This is common sense. If the page is not visible, then it should NOT do anything. If it's still hogging the cpu when I can't see it then that is lazy ass programming by a wannabe coder. The timer solution idea has been used in many applications and systems in the past, though not exactly the same way. It's hardly a new groundbreaking concept, it's quite like dynamic priorities in unix systems. Better to use have the headline read "Chrome throttles cpu usage of background tabs, but still is unable to completely stop them for fear of angering the advertising overlords."

        LOL!

  • 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!
    • by aurum42 ( 712010 )
      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.
      • by pla ( 258480 )
        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.
      • by tepples ( 727027 )

        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 [dashnet.org] and I'll explain.

  • by Anonymous Coward

    does that mean I can keep 500 tabs open, instead of 50?

  • 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".
    - If "playing audio" i

    • The easiest way would be a checkbox to turn off all audio, and not have audio sites have an exception. Even better, a checkbox with a whitelist, so the few sites I want to listen to (i.e. YouTube) are OK, but everything else gets muted.

  • 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 . . .

  • 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.

    • by l20502 ( 4813775 )

      Something changed and now Google wants to use it for more than that.

      1) Make a product that does something better than the competition
      2) Push your product to be bundled with everything
      3) When you have almost monopoly, do what the fuck you want

      Reminds you of something?

    • Browsers have pretty much replaced operating systems these days, so a browser has to have all the security features an OS does, because they execute untrusted code 24/7. Eventually OS makers will get smart, add tier 1 hypervisors, and have the browser be on its own VM with a separate memory and filesystem space, so a compromised browser doesn't hose the user.

      • Microsoft [arstechnica.com] has already started doing this with Edge. Mind you they are only doing it on the Enterprise version of Windows, but I could definitely see this happening on the consumer versions in the near future. It definitely makes sense considering all the stuff the browser is doing to make sure that it doesn't interfere with the security of the system.

  • by jtara ( 133429 ) on Wednesday January 25, 2017 @01:41PM (#53736771)

    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!

    • by vyvepe ( 809573 )

      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.

      This! I was reading this discussion to find out whether I need to post myself. You did it for me. Thanks :)
      No freaking way should background tabs run scripts by default.

    • by Altrag ( 195300 ) on Wednesday January 25, 2017 @04:58PM (#53738431)

      If you're using Chrome, check out an addon call The Great Suspender (maybe it exists in FF too, I haven't checked.) Its been a lifesaver for a tab hoarder like me.

  • 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 poi

  • 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.

    • by Altrag ( 195300 )

      Presumably, the throttling would a) not apply until the page is actually loaded and b) have enough initial budget that the vast majority of pages wouldn't notice for at least several seconds after the initial load is complete.

      I mean if you've got a webpage that manages to full bore your CPU for 10+ seconds as soon as it loads.. the page designer probably should be doing something different, throttled or not.

  • 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]

  • 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?

    • by Altrag ( 195300 )

      Do those tabs consistently use more than 1% CPU each? Cause if they don't, the throttling will likely have little or no effect on them.

      This is to stop stupid things like ad carousels that rotate every 5 seconds whether you're looking at them or not. Or just flat out poorly-programmed JS that sucks up all available CPU just because the developer couldn't be bothered with something more complex than busy loops and other dumb stuff like that.

      There will probably be the odd legitimate app that gets negatively

  • The motivation behind the chance is that some pages consume a lot of CPU when they are in the background.

    Okay, but what does luck have to do with it?

  • No web page should do anything when you're not looking at it. Full stop. Pun intended.

  • 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?
  • 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 do

  • >"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 refresh

Avoid strange women and temporary variables.

Working...