Well it might last 4-5x longer if you run safari in the background, since that is what you tested. But wouldn't the real test be running both browsers as the active window and comparing those results?
One thing that Safari is incredibly good at (and its' engineers are proud of) is the ability to reduce resource consumption for non-active tabs and windows to nearly zero. This is really good when running on battery because it is a shame to dedicate resources to things that aren't even visible on screen. But this could make the results far more dramatic through your test.
I would hypothesize that Safari still wins your performance test (if you were to re-test using them both as "active" windows), but probably not as dramatically as in the inactive window test.
I measured it with active windows now.
Screenshots:
- Both in background
- Safari Actie
- Firefox Active
Conclusion: it gets even worse for Firefox.
Edit: At the time of test Safari had 7 more windows open with probably 70+ tabs from my previous session that I didn't close.
I understand this is rare, but I just have a very very hard time understanding what is so hard about this.
Page not visible? Just stop it. Stop the layout engine, stop the javascript VM. If there was a transfer in progress, let it finish, a page might get the callback when it's active again ...
(I know there are some tricky cases, a lot of them, but there just isn't any reason why a browser with 30 tabs should be consuming over 1 % cpu...)
This is so easy and I, a software developer with no actual experience in that area, know the obvious solution that eludes that hundreds of developers with actual experience in the area. Meanwhile, I take umbrage when my product manager tells me that implementing the next feature will be easy and I'm exaggerating how complicated it is."
if (not_visible) { suspend_wait_and_stop_consuming_resources }
I can imagine that it gets massively more complicated. However, as, say, an executive, this probably indicates that you can lean on your sw dev staff to approach the asymptotic ideal that looks so simple if you really care about the goal.
[1] E.g. Firefox added some in version 58: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibi...
Well, the difficult part is not writing an if statement...
Contrats, you just broke the web for anyone doing one of the following:
- listening to music in the browser.
- having a webRTC chat with someone while browsing.
- keep reading another tab while waiting for a page to load.
And I'm probably missing a dozen of other totally legit use-cases.
Oh tell me about it. That's just about dead now. I mean, wasn't the point of multi tab browsing that I could do precisely that? Now I load Google Maps on my lethargic internet connection, go do something else for ten minutes, and come back and ... it starts loading when I open. This is on Firefox. Super sad.
Presumably there is no easy way to disable page JS but keep your youtube video downloading.
If they don't render while backgrounded, how do they do that without being noticeable?
I couldn’t find info on how often a keyframe is expected from YouTube, but I’m recalling the bad old divx days where you sometimes had a frame per scene and skipping was very slow.
No matter what you're doing, all but one of your tabs will be in the background at any given moment.
Does it mean that page in background isn't updated in Safari?
My problem is that Safari won't work for me as a daily driver so it's not an option. It seems too aggressive in memory management and in reloading.
So I'm very happy to see Firefox improve performance over Firefox-v1.
> I'd actually guess that WebKit runs on more platforms than Blink does…
I'd say they're probably at parity, if not a small edge given to Blink since an entire OS is built around it. Which would be the only exclusive case of the two I can think of.
I'm actually curious which WebKit browser you're using. GNOME Web?
https://austingwalters.com/simple-web-browser-in-cpp-using-q...
Works on any OS I've tried.
Nice bit of obscure knowledge that adds nothing to the conversation. Unless your argument is that KHTML and WebKit are the equivalent to Blink because of a shared ancestry; in which case you're arguing something I never claimed.
Firefox has (for now at least) a huge leg up in terms of content blockers. IDK if that's enough to even out the energy consumption and performance, but it can't hurt.
For my use, I keep many many tabs and windows open. Most of the efficiency gains I see are from handling that better. I don't use desktop Safari heavily. I tend to keep it as the thing I use when I suspect adblockers are messing up content (it's easier than disabling adblock). On my iPhone I do use an adblocker and haven't noticed problems. When I do browse the web without an adblocker I quickly recoil and think, "do people really live like this??"
Maybe, but what kind of performance hit will letting all the ads and nonsense through be? I probably could aim to find a trusty ad blocker for Safari, keeping in mind that Apple has left the disingenuously named uBlock up in their extension store. Or I could just stick with uBlock Origin and a browser that works with it.
I've got ~2000 tabs open in Firefox right now and don't feel like performance or battery life is a problem. I use 1Blocker on iOS, but it's clunkier, less effective, and more expensive than uBlock Origin (and I still get tons of in-app ads). That's not something I'm in any hurry to bring over to the desktop.
> (and I still get tons of in-app ads)
I'm pretty sure that's expected. 1Blocker's FAQ says it won't work with most third party iOS apps like Chrome.
I'm sure usage varies and I'm glad Firefox works well for you. I have Firefox 70 hidden with about 7 windows and 40 tabs (total) and Activity Monitor points to it as the highest energy suck bouncing between 15-20 of whatever units this measures--in line with CPU usage. I only installed uBlock Origin last night for Firefox. I use it mostly for work stuff which generally doesn't have ads. Chrome, where I'm typing this is about 1/3 to 1/2 the usage (and it's not hidden).
I was hoping for more of an improvement from Firefox. Historically, using Chrome or Safari will get me literally hours longer between charging.
I don't know what Safari is doing differently to Firefox, and no doubt Firefox can improve here, but when people say "it's easy, just completely stop running JS in background tabs" they have no idea what tradeoffs that entails. (Just as when people said "browsers should just refuse to autoplay videos" had no idea what they were talking about.)
It's common knowledge among web developers that browsers aggressively throttle background tabs so anybody who is designing a website that depends on it is misguided.
I don't hear anybody complaining about Safari being too aggressive with background tabs, I do hear people complaining that Firefox uses too much battery. So I think Firefox should be more aggressive.
These tradeoffs may also be different for different browsers. E.g. if you're Apple, perhaps breaking Web sites isn't a big deal since on iOS Safari is entrenched by fiat, and if users switch from Web apps to native apps, so much the better for Apple. For Mozilla that calculation works out differently.
Generally speaking "site X breaks in Firefox, works in Chrome" is a good way for Mozilla to lose market share.
(Not to say that it wouldn't be good if Firefox was better at it, but for those using Firefox, it might still be interesting until then.)
It doesn't work quite as transparently (or effectively) as Safari's equivalent functionality, but it does make a noticeable difference. It's worked very well for me.
[0] https://addons.mozilla.org/en-CA/firefox/addon/auto-tab-disc...
I've been using FF since it was in beta, never left but I'm starting to come around to the reality that native browsers are best optimized for the device. While there's no real native browser to leverage on desktop Linux, on macOS/Windows, native may be the best way to go for most people. This is how break down browsers to friends and family.
Google Chrome- optimized for Google's needs and profit margin.
Microsoft Edge- optimized for your device, if running Windows.
Apple Safari- optimized for your device, if running macOS.
Mozilla Firefox- optimized for the user. Certainly a noble goal, but I increasingly have a "mobile" goal and that trend isn't slowing for anyone.
I've also checked this newest version, 70 on Windows and my measurement of the power use give practically identical results to the measurements I've done almost two years ago.
I see that the power drain comes from the browser's own code doing something unnecessary and as far as I see it doesn't even appear to platform dependent.
It's surely possible to optimize that and it's obviously not their priority.
From what I've read, Mozilla can't really optimize rendering to the level of Safari & Edge. I found this article[0] on WebRender to be very interesting on this front. The author noted-
"Note: Painting and compositing is where browser rendering engines are the most different from each other. Single-platform browsers (Edge and Safari) work a bit differently than multi-platform browsers (Firefox and Chrome) do."
I love Firefox quite a bit, every detail, the way it scrolls with smooth scrolling off, the dedicated search bar for switching DuckDuckGo bangs, the container support. The dedicated search bar is a huge one, I can't imagine why no one else at least offers that, as a feature it can't cause that much maintenance headache. I definitely love FF as much as anyone here but I'm not one who argues that Gecko is necessary for a standards-based web, I'm not convinced by the argument. Webkit can be forked again and it has a significant userbase to act as a counterweight to Blink. It's increasingly difficult at this point to convince myself that native browsers don't make the most sense.
[0]https://hacks.mozilla.org/2017/10/the-whole-web-at-maximum-f...
So for me is simply: open some page, hear the fan for as long as the page remains open. Do the same with IE, silence.
BTW I otherwise haven't IE used for daily browsing, but I did a lot of tests with the same pages to see that it's not an accident and that IE does show the same content, but with less power used.
For somebody with a different computer: find any web page with more media playing on the page (you should see the videos playing or pictures "animating"), open the task manager (this is a Windows example) then switch to the graph view and compare the browsers while looking at the graph view. The task manager area "under the curve" reflects the power used -- the more CPU used for a given amount of time -- the more power used. In my observations the area drawn by Firefox is more that twice as big as the one by IE.
That's what drains the battery faster: taking more CPU to keep the "animations" on the page. Moreover Firefox has some consumption created by some of its background tasks even when the pages aren't animated, but the animations are really wasting a lot of power.
From my look at the behavior, having some experience in evaluating the performance of the software, and spending some time trying to figure out what's happening there, my impression is that the source of that power drain is in the Firefox code which is not platform specific which explains why they have problems on every platforms with that.
I've concluded they simply never actively tried to minimize overall CPU and GPU use (both will use more power unless somebody measures and tries to improve the code): even when they did move some pieces of processing to the GPU, their motivation was speeding up what's visible, actively minimizing the power used was simply not the part of their process.
You can also search their Bugzilla to see how they handle the problems with the CPU, GPU use and the power drain. This can be a part of the workflow, measuring that at least for every release and acting to fix the issues, but I just don't see that anywhere.
Agreed though, it's very noticeable and I never did feel it until I started using a laptop more than a desktop. I'm also finding bugs in the iOS version of Firefox which is probably going to be the last straw, not only does it freeze often, my bookmarks are no longer there and they were synced from my Firefox account. I'm likely to migrate to native browsers for whichever platform I'm on at that time. As you said in their own process they're focused on feature development but not efficiency. Overall, I'm losing faith that Mozilla has the resources to effectively manage all of this.
My advice to Mozilla would be to continue on the customizability and privacy route, and get Firefox on iOS in better shape. It's been freezing on me for as long as I can remember using it. Very buggy, and has played a significant role in losing some confidence in Mozilla.
This message and all of my messages in this thread posted from Microsoft Edge 78.0.276.20 (Official build) beta (64-bit).
Firefox: Threads 71, %CPU 2.5. Energy: 0.4. Opening the tabs all at once took up ~68% CPU. Energy went up to 75.
Safari: threads: 8, %CPU: 0.7-2. When opening the tabs: %CPU: 28%. Energy usage: 2.4.
Firefox grew sluggish when opening that many tabs at once. Safari handled it like a champ.
Pretty bleak for firefox.
Seems like Firefox cares only about Windows.
…which is why all the work was done to support Core Animation on macOS?
i posit that ad blocking is actually a net resource saver, probably not at the level of using safari over firefox but certainly over unprotected firefox
(i am on gnu/linux or else i'd do this myself)
So just fired a test on my Macbook Air - Safari 13 vs Firefox 70.
Opened top 10 links from techmeme. Both windows in background.
Firefox 70: Energy use 30-200; CPU 20-25%; Threads 82
Safari 13: Energy use 0.1-5; CPU 2-5%; Threads 11
If this is to celebrate I can only imagine what the things looked like before this release. Save for Apple fiddling with the energy use numbers (VW style) this means that my battery is going to last 4-5x longer with Safari. Can anyone replicate this for the sake of argument?
Edit: uploaded screenshots https://imgur.com/a/4L64ShP