Save the Planet: Kill Flash!

The browser-embedded Flash player (or a derivative) is the preferred small (and low quality) video delivery mechanism on the web-based Internet. While I completely understand the usefulness of such a player (or at least the amusement it procures), I can’t fathom why the hell it’s so resource hungry. That damn thing sucks an inordinate amount of CPU to play tiny videos! What’s wrong with this thing?

Let’s come back on the Eskimō Disco’s 7-11 video I posted a while ago. (Why? It’s a catchy tune and a cute video.) Let us play in a browser.

On my AMD64 2.something GHz box, with Firefox, the embedded Flash player for Linux is a complete CPU hog. It takes 30-40% to play a 320 × 240 FLV or H.264 video. On my Atom-based Dell Mini 10, it almost chokes the machine by using both CPUs at around 90%. On The Macbook Pro (2.8GHz T9600 dual core CPU), it still sucks about 20–30% (of one) CPU. On my pal Carl’s Windows 7 Core 2 (T6400@2.00GHz) laptop, it sucks 10%-30% CPU as well (see first screen-shot). Maxime’s OS X Flash player is even worse: on his 2.6GHz Core 2 Macbook, it sucks 35% of the CPU (see second screen-shot).

Flash on Windows 7

Flash on OS X

To compare, gnome-mplayer uses less than 10% CPU on the AMD64 machine and about 5% on the Macbook Pro; almost falling idle once in a while. So, what’s so wrong with the flash player that merely being run in a browser cranks CPU usage from a mere 5% to 20–30% ?

OK, granted, it seems to be somewhat OK for Windows, indicating that the makers of Flash do not care much for alternate operating systems and environments. Then, how can Flash be ready for the ultra-portable market? Would you want a half-bakedly ported Flash player suck up all your netbook’s or iPhone’s batteries because it is inefficiently coded? Because that seems to be the only viable hypothesis. If the player would be state of the art software, gnome-mplayer would also exhibit the same CPU consumption. But lo! it doesn’t. Gnome-mplayer (using ffmpeg, I would guess) is only five or six times faster. Not a mere 10-20% faster. Five or six times.

* *

So, you’re thinking, “yeah, we know Flash sucks, what’s new?”, but that’s not really my point. The point is, how many terawatts of power are wasted to this application by the users of sites such as Youtube? Ever wonder what the global cost of computation really is? Ever think of what will be the environmental impact of your application, if it is ever used by the masses?

Well, I do.

The first thing, owning a computer necessarily has a huge impact because, I’ve I discussed before, computers are made of a large quantity of junk, lots of it not even contributing to the actual computation. Changing computers regularly to accommodate bloated OSes and applications isn’t helping at all. Like cars, the only green computer is the one that you don’t build.

Here in Québec, due to the extremely low electricity rates, we think electricity as being basically free. Because our power sources are mostly hydro-electrical, we also like to think that it’s without impact on the environment. In the US, the cost of power on the environment is much worse: large segments of the power grid are fed by burning coal, nuclear fuel, and other stupid, non-renewable, power sources [ref]. Each watt wasted by poor programming is contributing to the global problem.

Save the planet! Kill Flash!

* *

Thanks to my pals Carl for the Windows 7 screen-shot, and Maxime for the OS/X screen-shot.

6 Responses to Save the Planet: Kill Flash!

  1. martialc says:

    What’s the problem ?

    The version you’ve tested didn’t have hardware acceleration for videos…

    The software you’ve tested all had hardware acceleration implemented, so yeah, that’s a HUGE difference.

    Flahs Player 10.1 now have hardware acceleration, it should correct the problem, at least on windows.

    Mac users (because of Apple !!!) will have to wait a bit for their own flash player with builtin hardware acceleration.

    • fdgonthier says:

      It took several years for Adobe to catch up with video hardware and accelerate their player. While the OS makers are not exempt of blame, I think Adobe sucked up CPU cycles uselessly for a while.

      On the computer where I have tried it, hardware accelerated Flash did make a difference in the quality of the video played but not that much in the % of CPU used. On low power device such as netbooks, power consumption from Flash is still very significantly higher than plain old video player such as mplayer.

      In fact, I would not be surprised if the author had acceleration enabled when he tested Flash for this article.

    • Steven Pigeon says:

      I confirm fdgonthier’s results: all platforms tested had 10.1.something; hardware acceleration enabled.

      One could think the hardware acceleration on the atom netbook is less than fantastic (due, in great part, to the quasi-total lack of support for the Poulsbo chipset) but on the other boxes, there are powerful nvidia-based chipsets and GPUs. And Flash still sucks.

    • mDuo13 says:

      Adobe can and should do better. How many years has video acceleration existed without being implemented in Windows? Not to mention Linux or Mac. Adobe gave up on getting Flash to work on Linux x86_64.

      At least desktop Linux users are few enough that their boxes being CPU-hungry when playing Flash videos won’t have too big an impact on the environment. I’m sure that poor *nix support for CPU scaling on servers contributes a lot more power consumption in the end.

      • Steven Pigeon says:

        As far as codecs are concerned, there isn’t much that can be accelerated by generic graphics hardware. Scaling/resizing the image during playback can be taken over by the GPU, but decoding the compressed stream (decoding the bits, computing quantization, transforms, and everything else a modern video codec does) isn’t easy at all to accelerate using GPUs: usually, it’s taken over by the CPU only, possibly using extended instructions. That’s how almost all codecs do it.

        But if you look at ffmpeg or gstreamer, they’re capable of decoding flash video at a fraction of the runtime of the plug-in. Either the player isn’t well written at all, or there’s some very important performance loss due to the interaction between the plug-in and the browser. But, if I wouldn’t be too shocked at, say, 20-30% performance difference due to browser/plug-in interaction, 6x slower is just improbable. I’d put my money on a bad codebase on Adobe’s side.

  2. […] This post was mentioned on Twitter by JD Thomas and F-D. Gonthier, ITI Conferences. ITI Conferences said: LOL RT @fdgonthier: From a friend, #Flash Causes Global Warming: […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: