Open Bug 930586 Opened 6 years ago Updated 5 months ago

Firefox always shows up as "using significant energy" in OS X

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set

Tracking

()

People

(Reporter: forums, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [tpi:-][power])

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Firefox/24.0 (Beta/Release)
Build ID: 20130910160258

Steps to reproduce:

When running Firefox normally, OS X 10.9 always calls out Mavericks in the battery status widget as "using significant energy". This happens even before reinstalling Flash after the 10.9 install removed it -- the only plugin installed was the QuickTime plugin.



Expected results:

Firefox for Mac shouldn't be this powerhungry even just idling at adobe.com while reinstalling Flash; Safari and Chrome play nice with power management. App Nap support would be good, too.
OS: Windows XP → Mac OS X
Component: Untriaged → Widget: Cocoa
Product: Firefox → Core
This likely depends on the type of pages that are currently open. I've had roughly 50 tabs open for a few days now and Firefox isn't being called out. I get "No Apps Using Significant Energy" instead. Would it be possible to get a list of open websites at the time this happens?
Flags: needinfo?(forums)
(In reply to Jennifer from comment #0)
> When running Firefox normally, OS X 10.9 always calls out Mavericks 

I'm assuming this was supposed to read "always calls out *Firefox*"
I have the opposite problem with Nightly :-)

While running this demo, http://jamesfriend.com.au/pce-js/, the CPU usage and energy usage go up. But Nightly never shows up in the battery status widget.

I can confirm in Activity Monitor (using the the Windowed Processed view) that Nightly is using a good 30 to 60% energy.

This might be related to 931521
> I can confirm in Activity Monitor (using the the Windowed Processed
> view) that Nightly is using a good 30 to 60% energy [with
> http://jamesfriend.com.au/pce-js/].

I see roughly the same thing.  But I also see that Safari's
performance is much worse, at least on the low end -- its "energy
impact" never goes below 50%.
I'm not sure what exactly the "energy impact" number means, and I can't find anything specifically documenting this.

I've been watching the EI as I browse and even ordinary sites that don't use Flash (that I can see, at least) seem to be kicking the EI up to anywhere between, usually, 11 and 20. Right now as I type this, it's sitting at around 14, spiking to 22 as I type. And sometimes it spikes even higher than that when it theoretically is sitting idle doing nothing with only a basic page (this one) in the foremost tab and no videos or anything of the sort playing in the background -- it just spiked to 27, for example.

It hasn't gone off "significant energy usage" since a minute or two after I launched it.
Flags: needinfo?(forums)
If, as the title of this bug suggests, Firefox is permanently listed in the Battery widget as a Energy Hungry app, then we indeed have a problem.

(I do not see this with Firefox 25 on a Retina MacBook Pro - But things may be different for other types of hardware)

That said, all apps use energy. Some more than others. In case of a web browser it also heavily reflects the complexity and activity of the web page that is being opened or looked at. So this can be really difficult to assess without proper context. (What kind of pages are open, what is the active page, etc.)

There will always be power spikes. That is totally normal when you load page or when the page 'does something. It can run JavaScript, embed Flash, play a movie, etc. All these things cause CPU usage to go up and thus energy usage too.

So I don't think it makes much sense to report spikes that are the result of some user action (or an active page running in the foreground).

Unless of course you think Firefox is using an abnormal amount of energy while it should be idle.
> all apps use energy

Precisely.

It's pointless to just look at Firefox's behavior here.  We also need to compare it with other browsers -- particularly Safari, which is most likely to make full use of Mavericks' new power-saving APIs.  If we find some URL/circumstance in which Firefox's "power consumption" is significantly worse than Safari's, then we have a real bug.  Or more likely we have a separate bug for each distinct circumstance.
Depends on: 932602
No longer depends on: 932602
No longer depends on: 932614
I can get Firefox 26 beta to continuously show up as "using significant energy" when run in safe mode and only showing this bug. Safari, showing this bug (url) does not appear as "using significant energy".
(In reply to Damien Glancy from comment #8)
> I can get Firefox 26 beta to continuously show up as "using significant
> energy" when run in safe mode and only showing this bug. Safari, showing
> this bug (url) does not appear as "using significant energy".

Not getting it to happen when on nightly [28.0a1 (2013-12-08)]
I'm new to Firefox/Bugzilla/Mozilla but I am a OSX objective-c/AppKit developer. What do I need to do to move this bug to "confirmed" status?
That status doesn't mean very much.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(In reply to Josh Matthews [:jdm] from comment #11)
> That status doesn't mean very much.

Ok, thanks!
I can confirm this behaviour. Not only does it (regularly) show up, the life span with a 100% battery drains from roughly 4 hours when using Safari and Mail to 1,5 hours when using Firefox and Mail. In addition, the battery status will show "Maintenance needed" when running Firefox; not when using any other app.

The energy impact remains between 35 and 50.
(In reply to Gautam Kok from comment #13)
> In addition, the battery status will show "Maintenance needed" when 
> running Firefox; not when using any other app.

This issue is unrelated to Firefox, however Firefox power usage may uncover that problem with your device.
I'm also experiencing this.  Retina MacBook Pro 15 inch 2012 model, Firefox 28.0 installed, OS X Mavericks 10.9.2.
yes this indeed is a problem. I am on 15" rMBP. many times it just heats up when im browsing using firefox. While the same does not happen when using safari or chrome (browsing the exact same pages). Its more significant when streaming. One thing which i have observed consistently is that safari is able to stream for more hours while on battery and does not heat up the mac too much; while firefox causes it to heat significantly enough that i need to put my laptop down.  Battery consumption is also 1-1.5x more compared to safari. Yes, type of usage can cause power spikes, but it would be great if we could optimize JS/DOM to give users a better experience; esp since other browsers are doing it.
This bug does indeed exist.  Nothing but this bug report open and it shows up in the battery panel on OS X 10.9 and on a Mid 2014 Macbook Pro.  It also does not happen with other browsers.
I'm noting the same behavior on Mac OS X 10.9.4 on MacBook Air 2014. Normal Firefox usage with little else open (Mail, periodic use of other system apps) and I'm noting not only the "apps using energy" notification, but also very low battery life. I'm going to switch out for now. Firefox 36.0b and 35 have same issue.
Since I stopped using Firefox on YOSEMITE, my MacBook Pro Retina 13" lasts 2 more hours on battery.  A good site to show the difference between Safari and FF is Twitter.   Just opening Twitter site spikes FF to 35% CPU and stays above 20% without touching Twitter page.  Safari never goes above 6% and drops back to 1.2%.
(In reply to Dan from comment #19)
> Since I stopped using Firefox on YOSEMITE, my MacBook Pro Retina 13" lasts 2
> more hours on battery.  A good site to show the difference between Safari
> and FF is Twitter.   Just opening Twitter site spikes FF to 35% CPU and
> stays above 20% without touching Twitter page.  Safari never goes above 6%
> and drops back to 1.2%.

That is probably bug 962594. You might want to try the workaround in bug 962594 comment 47.
(In reply to Birunthan Mohanathas [:poiru] from comment #20)
> (In reply to Dan from comment #19)
> > Since I stopped using Firefox on YOSEMITE, my MacBook Pro Retina 13" lasts 2
> > more hours on battery.  A good site to show the difference between Safari
> > and FF is Twitter.   Just opening Twitter site spikes FF to 35% CPU and
> > stays above 20% without touching Twitter page.  Safari never goes above 6%
> > and drops back to 1.2%.
> 
> That is probably bug 962594. You might want to try the workaround in bug
> 962594 comment 47.

Does this workaround disable all animation?  If so, I will stick to Safari for now.
After a recent Firefox update, probably the update to 37.0, within a few minutes of starting Firefox, my MacBook Pro running Yosemite starts to heat up and the fan screams for mercy. Looking in Activity Monitory, I see that Firefox is using a lot of CPU. Quitting Firefox solves the problem and the fan stops after about one minute. This has been repeating for about the past three days.

I've been a Firefox user for more years than I can remember. Today was a sad day because I had to switch my default Web browser to Chrome.
Since Firefox V36 the battery drain on sites likes Twitter has been fixed.  Thank you!
I experienced the same battery drain problem with my MacBookAir7,1 (2015) running Firefox 37.0.1

The average energy impact of Firefox for the past 8 hours was 138.12
http://oi57.tinypic.com/jp7qqd.jpg

Maybe Firefox can implement support for "App Nap" so when it's hidden behind other windows it will not consume that much power.

https://support.apple.com/en-us/HT201464#energy
(In reply to Caphy from comment #26)
> Maybe Firefox can implement support for "App Nap" so when it's hidden behind
> other windows it will not consume that much power.

See bug 931651.
I'm seeing about 3x the energy impact with Nightly compared to Safari at http://tinypic.com/view.php?pic=21d4ia8&s=8#.V04Py9xuVIY.
Summary: Firefox always shows up as "using significant energy" in OS X 10.9 Mavericks → Firefox always shows up as "using significant energy" in OS X
Whiteboard: tpi:?
Version: 24 Branch → Trunk
Whiteboard: tpi:? → [tpi:-][power]
Hi, everyone - 

Mike Hoye here, Mozilla's engineering community manager. 

I think we've got enough confirmation here that this is an issue - if you've got more information to add that will make this issue easier to understand and fix - power-usage profiling or something comparable - then by all means add it in. 

For the moment, though, more confirmation isn't going to move this bug forward. It's on our radar, and we won't lose track of it.

Thanks.
Seems to be resolved in Firefox 56 on my Macbook pro with no legacy add-on enabled. My CPU fan used to surged with a loud noise when Firefox opening certain complex page and this phenomenon almost disappears. And after 12 hours work the 'Avg Energy Impact' value in Activity Monitor app keeps lower than 20, which basically higher than 60 in the past.
Bravo, Firefox!

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:56.0) Gecko/20100101 Firefox/56.0
Build ID: 20171024165158
Attached image firefox_energy.png
(In reply to Mike Hoye [:mhoye] from comment #36)
> I think we've got enough confirmation here that this is an issue - if you've
> got more information to add that will make this issue easier to understand
> and fix - power-usage profiling or something comparable - then by all means
> add it in. 

How would I gather such information (power-usage profiling, etc0? Any guide?

Unfortunately with Firefox 59.0.2 (64-bit) on High Sierra (10.13.3) the problem is still noticeable (I have roughly 50 tabs in two windows).
Bug 1430820 had a fix landed today (showing up in tomorrow's nightly i think?), which may impact power consumption for some Mac users.

Some other related issues around Mac OS and CPU usage:

* Fixed in 59: High CPU Firefox 57 & 59 on Mac: www.theguardian.com/uk, Firefox 52 ESR has low CPU https://bugzilla.mozilla.org/show_bug.cgi?id=1419079

* Some configuration tips and tricks to play with in this one: high GPU load and excessive power usage https://bugzilla.mozilla.org/show_bug.cgi?id=1422090

* Another config change you can make to improve things for now: Poor battery life on OSX with scaled resolution https://bugzilla.mozilla.org/show_bug.cgi?id=1404042

* [10.9] Investigate support for Mavericks' App Nap https://bugzilla.mozilla.org/show_bug.cgi?id=931651

* MacOS 10.13:- twitter.com has high CPU & GPU load. Possibly not replicated on Ubuntu or MacOS 10.12 https://bugzilla.mozilla.org/show_bug.cgi?id=1425684

* Firefox uses a lot of CPU on MacOS https://bugzilla.mozilla.org/show_bug.cgi?id=1420699
Also, with my profile (504 tabs, currently), Nightly used to be permanently cemented in this menu, in it's silk smoking jacket, lazily swirling a class of expensive scotch and looking back it me with a smirk.

Now, I almost never see it. Sadly, I didn't watch closely enough to know exactly when it dropped out, or over what period of time.
Thanks for the comprehensive list. I skimmed over them and well, it looks like there is a problem but it's a bit hard to track. For me the bigger issue than "huge battery impact" is that it also spins up to 20-30% of CPU which causes MBP to get quite hot.

https://bugzilla.mozilla.org/show_bug.cgi?id=1419079 seems most relevant, but it's marked as Fixed in 59, and as I use that version I'm still affected.

about:performance listed two sites at the top:
* https://ruben.verborgh.org/blog/2017/12/20/paradigm-shifts-for-the-decentralized-web/#apps-become-views-p-6
* https://www.fluentu.com/blog/english/how-to-improve-english-pronunciation/ 

But they were green and their respective CPU were around 0-1% while the Firefox process was 20-30%. After closing and reopening the first tab CPU usage went down (and machine got cooler).

There is (I think I read about it) a mechanism, to hibernate tabs in the background but it doesn't seem to kick-in -- it would be cool to manually select tab and "hibernate" it.
Also, would be cool to have something like Chrome (sic!) Process Monitor with CPU usage of every part to quickly identify which tab may be a culprit (unfortunately about:performance is not very handy and the information provided seems to be a bit off).
@perdrisat - thanks a million! I found the second one but I din't want to have it automatic, but the first one seems like a win for me!
You need to log in before you can comment on or make changes to this bug.