That would get annoying soon. You won't want your browser to ask for that permission or throttle page layout to use 1% of a single core during page loads or the moment that browser-based shooting game gets lively and requires fast reactions, for example.
I think it would be better to give each tab a power budget that, initially, allows it to run for S seconds at full power, and that give it new budget at a rate of x < 100% of max power every second.
However, I fear that still won't be enough. The list of heuristics and exceptions could get so long that the resulting benaviour becomes difficult to explain.
I've noticed that a lot of sites will end up using 100% CPU usage on their Chrome tab. I haven't investigated, but I do wonder what sort of faulty design leads to this. You occasionally hear talk of sites using your CPU to mine cryptocurrency, but I'm more inclined to suspect lousy programming.
I sometimes wish I had an easy way in Chrome to restrict a tab to, say, 5% CPU, for the cases where the CPU usage is clearly not adding any value. Just so I can get through an article without the fan ramping up.
That would be pretty disappointing if they can't handle normal processes too. It's easy to end up with a bunch of processes that are using small amounts of CPU but aren't dedicated background tasks.
Even just looking at a browser, I might have half a dozen generic tab processes open, each using a small amount of CPU. But then I navigate one to a game, and I want that particular tab to get near-exclusive access to the big core while the others use only the little cores.
Solutions along these lines (though probably not centralized like this one) are interesting alteratives to ads, but if you want to make them acceptable to the end-users you HAVE to make them AT LEAST stoppable and configurable (by the end-users).
Here are some negative effects of abusing the cpu without the user's consent that come to my mind:
- the obvious, energy consumption (and thus money). In some cases it
can be significant, and it will for sure be if these things become
widespread
- it can rev-up the fans, up to extremely annoying noise levels
- on the many old devices that are unable to keep the temperatures
down on high loads it can warm-up the device up to dangerous
levels, high enough to:
- make the device protection features shut it down
- make the device catch fire, if there are no protection features
or they don't work well enough
- ruin some components of the device
- in any case for sure reduce the lifetime of some components
- it lowers battery life on battery-powered devices
- it can easily interfere with the other activities of the user: a
process using a lot of cpu time will easily reduce the performance
of other parts of the system, even if the user were to lower its
priorities
- on the many browsers that don't allow constraining the resources
allotted to individual tabs/servers/scripts it can interfere with
the usage of the browser
- even on the browsers that do support constraining the resources it
will easily require some annoying work on the part of the user to
investigate which tab/server/script is responsible
So you _might_ activate them by default when (really) throttled to a low cpu usage amount, as others suggested, but if you do so you must make them easy to turn off or to configure to a lower usage.
You should consider that an user might be concurrently visiting multiple sites that use this thing, so individual low cpu usages can add-up to a considerable amount.
It might be better indeed to have a means to configure all instances of the script from a single place; I know, hard to do probably.
But really, at least until/if these things become widespread, well understood and standardized (possibly with apis to let the browser control them automatically), it is much better to activate them only at the request of the user.
How to push users to opt-in, without being obtrusive?
Make a big button "DISABLE ADS", with a smaller writing under it "by switching to cryptomining".
When the user clicks it, replace it with two buttons "Turn-off cryptomining - (by re-enabling ads)" and "Configure cryptomining".
Someone might think that it would be unjust to let the users configure the amount of cryptomining, but in reality:
- there are already unfairnesses in the facts that
- users with more energy-hungry systems will pay more than others
- users with more powerful systems will mine more and thus give
more money to the sites and the others involved
- it will always be possible to block them entirely with
script-blockers or other means; that's the state of things and we
should be glad that it's so: Internet would probably become a much
less useful sh*t in the unlikely event that blockers became
preventable; an unprofitable internet would most likely have still
much more potential than one that supported forcing ads or scripts
to the end-users.
It should be possible to do the same thing on anything that supports CPU frequency scaling. Tell the OS that the core the browser is running on should only run at the lowest supported frequency. Or only allow it to run at higher frequency if it hasn't been active for more than 15 of the last 60 seconds.
I'm on linux with a powerful GPU, if that matters.
I noticed that I spend quite some time every day finding and killing tabs that hit the CPU. It's becoming a distraction to my actual productive work: I'm dual tasking. The fans tell me when there's one tab stuck. It's very often the case. Why is the web so complex that so many sites need so much CPU/GPU power? What can you do about it, other than navigating with JS off?
I don't really get what he's saying.
Most of the time you will have one active tab, which is consuming a lot of CPU, and all the other tabs in the background will do nothing. Dividing those background tabs onto multiple cores won't bring any significant performance enhancement.
Assuming you are using a reasonable browser with a reasonable set of websites open, a browser should not really burn unbounded CPU in the background. Tabs that do are generally throttled, allowing the scheduler to burst their work and then have the processor go back to sleep.
Background services (Discord, etc) use a negligible amount of processor power. It should be like sub-5% on a modern processor, with the processor clocked down to its lowest frequency. With the processor at turbo, you should be pulling 1-3% easily, even actively using multiple tasks.
These days even Chrome is very aggressive about throttling background tabs, much to the consternation of some webdevs here.
Am I the only one that doesnt like this "feature"? The reason I dont like it is because now, instead of being limited to 25% of my total CPU usage, at times Chrome happily pins all four of my cores. Granted that this is probably a result of poor plugin/webpage interaction (although, I havent been able to determine what combination...being a heisenbug and all), in Firefox, the worst case is still 25% maximum CPU usage.
> CPU usage (allow an initial burst, but after a few seconds dial down to max ~0.5% of CPU, with additional bursts allowed after any user interaction like click or keyboard)
Funny how Mozilla spent so long trying to make firefox multi process and right after they got there it was decided that we had to throttle these process anyway.
I think it is not acceptable for a webpage to max out my CPU, just by visiting the page. If it does it after I have pressed some button or something, it would be okay.
Very beautiful theme but when I'm on the page my CPU starts consuming 25% (100% of one core). That's insane!
If I move to UI Features the CPU usage is 30% because the Progress Bars. When the animation stops, the CPU is on a constant 6-7%. When using the sliders from the UI Features, the CPU is 31% again. As I said: insane.
I think it's very important to understand that you (the creator of a web framework) don't own the CPU of your users. Using a 5%-10% ocasionally should be the maximum allowed, because the user will be doing other stuff at the same time, and we don't want to leave the computer unusable and a very slow browser.
(Note: I'm using Firefox 16.0.2 under Debian/Testing.)
Could the CPU load be reduced? If I am only on the page, not even playing any music yet (probably because something is blocked), I get 1 core up at 100% CPU load. This can't all be for an animated background image, can it?
That's wierd - I show a cpu usage of about 48-52% on one of my four threads (2 cores) when I have the tab open, and under 5% on all with the tab closed.
This is on Firefox, Linux.
A side note: I started involuntarily humming the star wars theme to myself as the text started to scroll... I dare say: George Lucas has hacked my brain!
Yes, but they're not doing it to optimize power consumption fro web browsing. Web browsing consists of a typically very short burst of work (parsing and rendering) followed by long periods of idleness while the user actually looks at stuff.
CPUs power consumption is important when you're using it constantly, but most web browsing doesn't do that.
I think it would be better to give each tab a power budget that, initially, allows it to run for S seconds at full power, and that give it new budget at a rate of x < 100% of max power every second.
However, I fear that still won't be enough. The list of heuristics and exceptions could get so long that the resulting benaviour becomes difficult to explain.
reply