# Need fix for browser throttling

**URL:** <https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056>\
**Category:** Factual Questions\
**Created:** [December 13, 2018, 1:50pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056 "2018-12-13T13:50:42Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doug\_K](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Doug\_K](https://boards.straightdope.com/u/Doug_K)\
**Post date:** [December 13, 2018, 1:50pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/1 "2018-12-13T13:50:42Z")

</div>

I’m using a fairly new iMac running High Sierra(starring Leif Ericson and Cameron Mitchell). The issue I’m having is that a javascript site I use on chrome (it’s an idle game) slows down by about 90% when the display sleeps. End result is after running in the background all day it’s done less than an hour’s progress. I’ve gone into Chromes flags and turned off “Throttle expensive background timers” and I also have caffeinate running from a terminal window. Is anything I can do to keep it going unattended at full speed?

---

<div class="post-metadata">

**Author:** ![joema](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@joema](https://boards.straightdope.com/u/joema)\
**Post date:** [December 13, 2018, 3:28pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/2 "2018-12-13T15:28:27Z")

</div>

Can you try Safari or FireFox just as a test to see if the behavior is the same? The display sleeping is a hardware item (I think), I don’t understand why it would affect an app. It is possible more than the display is sleeping and the system is somehow entering an energy saving state, despite the caffeinate utility. As a test turn off all power saving features. You want to verify it’s a client-side issue, not the server or network slowing down. If the javascript code is somehow single-threaded on disk or network I/O or some server-side ack, the entire web app might slow down if any of those slow down – even if all client-side power saving features are disabled. Testing that is one way to find out.

---

<div class="post-metadata">

**Author:** ![Doug\_K](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Doug\_K](https://boards.straightdope.com/u/Doug_K)\
**Post date:** [December 13, 2018, 4:48pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/3 "2018-12-13T16:48:03Z")

</div>

> [@joema](#):
>
> Can you try Safari or FireFox just as a test to see if the behavior is the same? The display sleeping is a hardware item (I think), I don’t understand why it would affect an app. It is possible more than the display is sleeping and the system is somehow entering an energy saving state, despite the caffeinate utility. As a test turn off all power saving features. You want to verify it’s a client-side issue, not the server or network slowing down. If the javascript code is somehow single-threaded on disk or network I/O or some server-side ack, the entire web app might slow down if any of those slow down – even if all client-side power saving features are disabled. Testing that is one way to find out.

I get the same behavior in Safari and FireFox. Turning off power saving features is no longer an option. The computer sleep slider was removed from the OS a few years ago. Caffeinate is now the only way to tell the computer not to sleep when the display is off unless the app lodges a power assertion. They seem to be operating on the assumption that everyone is running on batteries now, and have gotten overly aggressive with power saving features.

I just ran a python benchmark while the javascript site was running. The site slowed way down while the screen was off, going from ~5 seconds per cycle to ~45 seconds per cycle. The benchmark kept running at the same speed, doing one cycle every ~4 seconds. So it seems to be the browser that is slowing down, except that all three browsers do it.

---

<div class="post-metadata">

**Author:** ![joema](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@joema](https://boards.straightdope.com/u/joema)\
**Post date:** [December 13, 2018, 6:39pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/4 "2018-12-13T18:39:07Z")

</div>

What about the Power Saving option “Prevent computer from sleeping automatically when the display is off”? Does that do anything in this case? If that is checked I don’t understand why the display would affect app behavior. That implies it’s not just shutting off the display backlight but maybe the graphics system or putting it into a low-power mode which causes certain APIs to be delayed.

What if you turn off the display timeout in system prefs \> energy saver and just manually turn down the screen brightness to zero using the keyboard? If only as a test that would be interesting.

There are other “stay awake” apps besides caffeinate, but I haven’t used them: [‎Amphetamine on the Mac&nbsp;App&nbsp;Store](https://itunes.apple.com/us/app/amphetamine/id937984704?mt=12)

---

<div class="post-metadata">

**Author:** ![iamthewalrus\_3](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@iamthewalrus\_3](https://boards.straightdope.com/u/iamthewalrus_3)\
**Post date:** [December 13, 2018, 7:35pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/5 "2018-12-13T19:35:03Z")

</div>

> [@Doug\_K](#):
>
> I get the same behavior in Safari and FireFox. Turning off power saving features is no longer an option. The computer sleep slider was removed from the OS a few years ago. Caffeinate is now the only way to tell the computer not to sleep when the display is off unless the app lodges a power assertion. They seem to be operating on the assumption that everyone is running on batteries now, and have gotten overly aggressive with power saving features.

Is that new in High Sierra? I’m running Sierra and I still have a “Never” put the display to sleep option and checkboxes to disable power saving features.

---

<div class="post-metadata">

**Author:** ![Doug\_K](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Doug\_K](https://boards.straightdope.com/u/Doug_K)\
**Post date:** [December 13, 2018, 9:28pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/6 "2018-12-13T21:28:29Z")

</div>

> [@iamthewalrus\_3](#):
>
> Is that new in High Sierra? I’m running Sierra and I still have a “Never” put the display to sleep option and checkboxes to disable power saving features.

It was changed in 2015. There used to be a slider for when the computer could sleep right under the slider for when to put the display to sleep. That slider has been gone for some time. The checkboxes don’t really prevent it from sleeping. [Here’s an article](https://apple.stackexchange.com/questions/188682/sleep-timeout-missing-from-the-energy-saver-preferences) about the change from 2015.

But in this case it appears caffeinate does prevent the computer from sleeping, it just greatly slows down the javascript running in browsers, to roughly 10% of normal speed. I don’t know whether the browsers do that, or the system, but turning that flag off is _supposed_ to prevent that.

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 13, 2018, 9:32pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/7 "2018-12-13T21:32:03Z")

</div>

> [@Doug\_K](#):
>
> It was changed in 2015. There used to be a slider for when the computer could sleep right under the slider for when to put the display to sleep. That slider has been gone for some time. The checkboxes don’t really prevent it from sleeping. [Here’s an article](https://apple.stackexchange.com/questions/188682/sleep-timeout-missing-from-the-energy-saver-preferences) about the change from 2015.
> 
> But in this case it appears caffeinate does prevent the computer from sleeping, it just greatly slows down the javascript running in browsers, to roughly 10% of normal speed. I don’t know whether the browsers do that, or the system, but turning that flag off is _supposed_ to prevent that.

You could try pmset.

pmset -a sleep 0

That should prevent sleeping.

---

<div class="post-metadata">

**Author:** ![iamthewalrus\_3](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@iamthewalrus\_3](https://boards.straightdope.com/u/iamthewalrus_3)\
**Post date:** [December 14, 2018, 12:27am UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/8 "2018-12-14T00:27:01Z")

</div>

> [@Doug\_K](#):
>
> It was changed in 2015. There used to be a slider for when the computer could sleep right under the slider for when to put the display to sleep. That slider has been gone for some time. The checkboxes don’t really prevent it from sleeping. [Here’s an article](https://apple.stackexchange.com/questions/188682/sleep-timeout-missing-from-the-energy-saver-preferences) about the change from 2015.

Ignorance fought. Thanks.

---

<div class="post-metadata">

**Author:** ![Doug\_K](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Doug\_K](https://boards.straightdope.com/u/Doug_K)\
**Post date:** [December 14, 2018, 1:35am UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/9 "2018-12-14T01:35:09Z")

</div>

> [@beowulff](#):
>
> You could try pmset.
> 
> pmset -a sleep 0
> 
> That should prevent sleeping.

pmset -g reports that sleep is prevented by caffeine. Anyway, it continues to run while the screen is off. Just that all browsers running javascript go verrrrrrrryyyyyyy slllllloooooowwwlllyyyy.

I can’t find it now, but awhile back I recall reading a discussion where somebody said he had some important system monitoring equipment that used an embedded javascript web app, and that with this throttling it was causing important events to not be logged if they happened in between cycles.

I’d love to be able to watch Activity Monitor when this is happening, but obviously I can’t see it when the screen is asleep, and it doesn’t slow down when the screen’s awake.

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 14, 2018, 1:46am UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/10 "2018-12-14T01:46:27Z")

</div>

Can you just turn off screen sleep?

---

<div class="post-metadata">

**Author:** ![Doug\_K](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Doug\_K](https://boards.straightdope.com/u/Doug_K)\
**Post date:** [December 14, 2018, 4:39am UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/11 "2018-12-14T04:39:39Z")

</div>

Leaving the screen on 24/7 is not a good idea. Also, I’ve tried using a blank screensaver, but the problem occurs when the screensaver is on as well. I suspect that even if I had a separate monitor instead of a built in one that the OS would detect if I shut it off.

It used to be possible to turn the brightness all the way down, but they’ve taken that feature away as well. I don’t know whether that’s a software or hardware thing.

---

<div class="post-metadata">

**Author:** ![joema](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@joema](https://boards.straightdope.com/u/joema)\
**Post date:** [December 14, 2018, 12:12pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/12 "2018-12-14T12:12:30Z")

</div>

> [@Doug\_K](#):
>
> I’d love to be able to watch Activity Monitor when this is happening, but obviously I can’t see it when the screen is asleep, and it doesn’t slow down when the screen’s awake.

Unlike Windows Performance Monitor, the macOS Activity Monitor won’t monitor a remote machine. However –

You can run the terminal “top” command (which gathers process stats) to a file and later examine this. E.g. top -s 10 \> topout.txt

This runs the command line statistics app “top” every 10 sec to the output file topout.txt. After the display goes to sleep this should keep running. You could later cancel the command via CTRL+C, then examine the file with TextEdit.

If 10 sec is too quick and makes the file too large, try 15, 30 or 60 sec.

Another approach is remotely connecting from another Mac via SSH and running top remotely. Procedure:

(1) Enable remote login on the target machine via System Preferences\>Sharing.  
(2) From your client machine run terminal  
(3) Use the terminal menu Shell\>New Remote Connection  
(4) Provide the login to the target machine in that dialog  
(5) On the client machine in terminal type the admin password of the target machine

You will then be running SSH terminal connected to the remote machine. You can run top or most other commands which will execute on the remote machine via the network.

For details on top, see the man page, e.g, “man top” from terminal. There are other more advanced command line monitoring tools such as htop which can run remotely via SSH but they require installation via a package manager: [htop – the task manager for Linux, Mac OS X and BSD - IONOS](https://www.ionos.com/digitalguide/server/tools/htop-the-task-manager-for-linux-mac-os-x-and-bsd/)

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 14, 2018, 2:19pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/13 "2018-12-14T14:19:43Z")

</div>

> [@Doug\_K](#):
>
> Leaving the screen on 24/7 is not a good idea. Also, I’ve tried using a blank screensaver, but the problem occurs when the screensaver is on as well. I suspect that even if I had a separate monitor instead of a built in one that the OS would detect if I shut it off.
> 
> It used to be possible to turn the brightness all the way down, but they’ve taken that feature away as well. I don’t know whether that’s a software or hardware thing.

All modern screens are LED-illuminated, so leaving them on 24/7 is OK.

---

<div class="post-metadata">

**Author:** ![joema](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@joema](https://boards.straightdope.com/u/joema)\
**Post date:** [December 14, 2018, 5:45pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/14 "2018-12-14T17:45:37Z")

</div>

> [@Doug\_K](#):
>
> …It used to be possible to turn the brightness all the way down, but they’ve taken that feature away as well. I don’t know whether that’s a software or hardware thing.

Note that your eyes are logarithmically sensitive to light. This means when your iMac display is turned to the dimmest setting, the actual illumination level (hence LED backlight power consumption) is _much_ less than it visually appears.

I just measured my 2017 iMac 27 with a lux meter, and at the brightest setting it produces 330 lux, and the dimmest setting only 2 lux, a difference of 165x. Yet the dimmest setting doesn’t look that dim – you can clearly see it. This is an artifact of how the human eye works. In fact the monitor is 1/165th as bright.

Although LED flux is not always linear with power consumption, for rough purposes we can consider it so. In general that means the monitor’s LED power consumption at the dimmest level is less than 1/100th the brightest level.

This implies just turning it to the dimmest setting has almost the same results (from a power and durability standpoint) as being totally off.

---

<div class="post-metadata">

**Author:** ![Doug\_K](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Doug\_K](https://boards.straightdope.com/u/Doug_K)\
**Post date:** [December 14, 2018, 6:08pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/15 "2018-12-14T18:08:47Z")

</div>

> [@joema](#):
>
> Note that your eyes are logarithmically sensitive to light. This means when your iMac display is turned to the dimmest setting, the actual illumination level (hence LED backlight power consumption) is _much_ less than it visually appears.
> 
> I just measured my 2017 iMac 27 with a lux meter, and at the brightest setting it produces 330 lux, and the dimmest setting only 2 lux, a difference of 165x. Yet the dimmest setting doesn’t look that dim – you can clearly see it. This is an artifact of how the human eye works. In fact the monitor is 1/165th as bright.
> 
> Although LED flux is not always linear with power consumption, for rough purposes we can consider it so. In general that means the monitor’s LED power consumption at the dimmest level is less than 1/100th the brightest level.
> 
> This implies just turning it to the dimmest setting has almost the same results (from a power and durability standpoint) as being totally off.

On my older one (which I still have) if I turn the brightness all the way down the screen goes completely black and the backlight turns off. On my newer one if I turn it down as far as it will go the screen is still visible in daylight. In the dark it’s still bright enough for the glow to be visible from the next room, which happens to be our bedroom.

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 14, 2018, 6:14pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/16 "2018-12-14T18:14:23Z")

</div>

What happens if you put up a completely black image as your screensaver?

---

<div class="post-metadata">

**Author:** ![joema](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@joema](https://boards.straightdope.com/u/joema)\
**Post date:** [December 14, 2018, 8:21pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/17 "2018-12-14T20:21:36Z")

</div>

> [@Doug\_K](#):
>
> … if I turn it down as far as it will go the screen is still visible in daylight. In the dark it’s still bright enough for the glow to be visible from the next room, which happens to be our bedroom.

My point is despite the _apparent_ brightness, it is consuming less than 1/100th the energy of max brightness. This can be very misleading because visually it only looks about 1/5th or 1/10th as bright. In actuality the display is consuming virtually no energy.

If the concern is the dim light bothers you at night (understandable due to night vision adaptation), maybe you could just put up a black screen, e.g, open terminal and maximize it.

The human eye operates over a very wide dynamic range and is incredibly sensitive at night. A young person can see dimly under starlight at 0.0001 lux. Yet their eyes also work at 110,000 lux on a bright sunny day, a difference of one billion times.

The tradeoff is we can’t accurately perceive two roughly similar (but different) brightness levels. This is why you visually perceive the dimmest iMac monitor as “still pretty bright” when in fact it is putting out less than 1/100th the energy of full brightness.

---

<div class="post-metadata">

**Author:** ![Melbourne](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Melbourne](https://boards.straightdope.com/u/Melbourne)\
**Post date:** [December 16, 2018, 12:30pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/18 "2018-12-16T12:30:42Z")

</div>

> [@beowulff](#):
>
> All modern screens are LED-illuminated, so leaving them on 24/7 is OK.

LCD screens don’t get phosphor burn, but they do get backlight failures. I wouldn’t leave a LED backlight on continuously if I wasn’t using it.

---

<div class="post-metadata">

**Author:** ![Doug\_K](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Doug\_K](https://boards.straightdope.com/u/Doug_K)\
**Post date:** [December 16, 2018, 3:56pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/19 "2018-12-16T15:56:28Z")

</div>

> [@Melbourne](#):
>
> LCD screens don’t get phosphor burn, but they do get backlight failures. I wouldn’t leave a LED backlight on continuously if I wasn’t using it.

[Here’s what Samsung says about burn in:](https://www.samsung.com/ae/support/tv-audio-video/are-led-tvs-subject-to-burn-in/)

> [@](#):
>
> Although much less susceptible than Plasma TVs, LED TVs are still subject to screen burn in (image retention). In general, you should avoid keeping a static picture (that is, a picture that contains no or few moving elements) or a picture with static elements (black bars, black borders, logos, etc.) on your LCD TV for more than two hours at a time. If, for example, you have your TV set to 4:3, and have black borders on the top and bottom, or on the sides, changing the picture size for a minute or two every couple of hours, say during commercials or in between shows, would decrease the chance of screen burn in. Reducing the brightness and contrast of the screen when it is displaying static elements will also decrease the chance of burn in.
> 
> If you are using your LED TV as a computer monitor, the same general rule holds true: Avoid keeping a static picture or a picture with static elements (black bars, black borders, logos, etc.) on your LED TV for more than two hours at a time.

But that’s become semi-moot, because I’ve since discovered that even if I let the screen stay on and turn off the screensaver the javascript process still gets throttled at some point. I don’t know how long it sits before slowing down because it only displays the last 10 cycles, but at some point the speed slowed down from ~6.6 seconds per cycle to ~54 seconds per cycle - dropping from 47million points per minute to 5 million points per minute. It immediately sped back up after I moved the mouse pointer.

Like I said before a bash script still continues to chug along at the same speed, so it’s not the whole system that’s slowing, apparently just javascript processes, which leads me to believe it’s browser behavior, not system behavior.

---

<div class="post-metadata">

**Author:** ![Melbourne](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Melbourne](https://boards.straightdope.com/u/Melbourne)\
**Post date:** [December 17, 2018, 8:37pm UTC](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056/20 "2018-12-17T20:37:27Z")

</div>

I’ve been reading with interest, hoping somebody would come up with an explanation.

Does anyone know how the javascript event loop works? Does your application have an asynchronous provess that is triggered by events?

[Next page](https://boards.straightdope.com/t/need-fix-for-browser-throttling/826056.md?page=2)
