Monday, 25 January 2010

On levels of suck…

Just now, the venerable John Gruber wrote a post mentioning the perception of it is at Apple, and in his post, he includes a link to a screenshot of a video playing simultaneously in Flash and VLC; whereas Flash uses 33% CPU to decode the video, VLC uses just 12%. At a superficial glance, this would appear to support a verdict of plentiful levels of suck. However, the impression given by the screenshot is misleading, and for one simple reason: Even for something which sucks, Flash sucks. The comparison is biased towards Flash by two factors:
  • The video appears relatively small; neither Flash nor VLC require significant effort to decompress it.
  • VLC uses a heavily optimised software decoder, and has different characteristics from the decoders built-in to the operating system.
Below is a screenshot of 1920×1080 YouTube video simultaneously playing in QuickTime Player and Flash on my summer 2009 13-inch MacBook Pro:


Whereas QuickTime Player uses about 15% CPU, Flash uses about 105%. Oh, and unlike QuickTime, it can't play the movie smoothly. Extra icing on the cake is the fact that Flash uses 5–10% CPU at idle, just displaying a still frame of the video. For reference, VLC and Google Chrome use software decoders and manage to play the video quite smoothly, using about 60-110% CPU. (Chrome decodes the video in one process and renders it in another; the rendering process uses about 25% extra CPU.)
And for video playback specifically, Flash’s performance pales compared to H.264 played through QuickTime. This is not subjective.
In my opinion, Gruber isn't quite fair in this statement; I agree that there's nothing subjective about the comparison, but I don't see the need to restrict it to QuickTime specifically. Given any half-way decent player, the performance of Flash will pale compared to it:
  • Flash rolls its own decoder rather than using the one provided by the OS.
  • Flash uses significantly more CPU when decoding small videos.
  • Flash cannot use more than one CPU core to decode video.
  • Flash cannot use any hardware acceleration available.
I doubt software this bad doesn't happen by accident — someone has to really not care about quality — and I seriously doubt it will change anytime soon. I can personally recommend enabling the HTML5 beta on YouTube and/or using ClickToFlash; the video experience suddenly becomes much less painful. Alas, the only thing missing is support for full screen video playback in the browser…

0 comments:

Post a Comment