I use Safari as my main web browser on my Mac. I know, that makes me an outlier. Why would I use such an “objectively worse” browser when Chrome is sitting right there in my Applications folder, just asking me, begging me to use it?
Well, I like Chrome for a lot of things, it really is emblematic for everything you would want in a web browser, both as a user and as a developer. But here’s the thing, Chrome has a fatal flaw that I just can’t get over. Chrome uses a hell of a lot of CPU!
I noticed this particularly when watching videos on YouTube. See, Google is presently holding back 4k playback from Safari because it does not support the VP9 video codec, which to Google’s credit is indeed a better video codec. Surely that means video will play better in Chrome, right?
To test this somewhat scientifically, I played this 3:33 video in Safari, Chrome, and Firefox with no other apps running (save for a few menubar apps) and tracked CPU usage with iStat for iOS. I played it at 1440p resolution twice, once at normal size, and once in full screen. Here’s what I found:
Safari at normal size
Safari at full screen
As you can see, 1440p video, even with the less efficient H.264 codec does basically nothing for my computer’s CPU. There are a couple spikes on the first graph, but looking at the stats, those were actually my calendar and photos services doing a quick sync in the middle of the video.
Chrome at normal size
Chrome at full screen
Now that is quite a difference! Chrome was consistently using 80-100% of my CPU (dual core setup, which is why it’s only half up the charts). I also noticed the video was a little choppy for moments here and there.
Of note, when I turned the video to full 4k after this test, my computer buckled under the pressure and couldn’t maintain a consistent frame rate.
Firefox at normal size
Firefox at full screen
Firefox does significantly better than Chrome, but still uses a little more CPU than Safari. It’s still not much, and I should note that Firefox is also relegated to using the H.264 codec, not the new VP9 hotness.
Built in apps often have special abilities to use a bit fewer resources than third party ones, but Firefox’s performance makes it seem like it’s not the browser itself, but the video decoder. To prove this hypothesis, I decided to play the video one more time (I know it quite well at this point) in Opera.
Opera at full screen
Opera stopped using their own rendering engine recently, and have started using Google’s Chromium instead. This means that YouTube is more than happy to play the fancy new VP9 version of the video at 1440p, and lo and behold the results are very similar to Chrome’s.
I tried it again in Vivaldi, which also uses Chromium, and the results were the same.
So what’s going on here?
The problem for Chrome is that H.264 is an industry standard and has been for years, which means hardware acceleration for this video is built into basically any platform you’re using. My Mac’s GPU does basically all of the heavy lifting when I play back an H.264 video, and my CPU can chill out for a while, and stay nice and cool. The Intel CPU/GPU in my machine was built with H.264 video in mind, and plays very nicely with it.
Meanwhile, VP9 is not a standard, and is mostly something Google is pushing on the rest of the world. Is it good? Yes, but it’s not something that is everywhere yet, and few places outside of YouTube use it at all (especially true among websites most people visit regularly). Therefore, my GPU can not play along with this, and it’s all on the CPU to decode and render that video on my screen.
In the end we have VP9, which is a file format that allows for reduced file sizes (a pretty big concern for the biggest video website on the internet) and more efficient performance if you can find hardware that supports it. Meanwhile, H.264 creates larger files, but much better rendering performance across almost all existing devices in 2017.
The good news is that Intel’s new Kaby Lake processor family finally has VP9 decoding “built in” and surely will tear through these videos much more efficiently. So when you see charts out there showing how little raw power Kaby Lake processors have over Skylake, remember that it’s not only extra cycles you’re buying in those new chips, but extra smarts like this. Now if only Apple would update their Mac lines to Kaby Lake…
In researching this article, I came across the h264ify extension for Chrome that makes YouTube flip over the H.264 version in Chrome as well. It does the job and sure enough drops CPU usage considerably on YouTube. CPU usage is still a couple times higher than Safari, but Chrome has other CPU-intensive tasks that have nothing to do with video decoding so that’s to be expected. This has helped make Chrome a little more usable for me, but it bugs me that my Mac can easily play an H.264 4k video, but YouTube is holding them back from Safari. Maybe they’re just trying to shove manufacturers to support VP9. YouTube is one hell of a stick to be able to use to make this happen.