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).
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!