Performance still sucks on Mac OS X compared to Windows Vista. Using the exact same computer (four-core 2.66 GHz Mac Pro with 6 GB of RAM), Hulu video playback consumes 56 percent CPU on Mac OS X 10.5 vs. just 7 percent on Vista. Flash video playback is about eight times more efficient on Windows. And yet people wonder why Apple isn’t anxious to get Flash on the iPhone.
Indeed – I'm constantly pissed off by the pathetic performance of Flash on OS X. It's very easy for me to tell if a web page uses Flash content – and be it only the most trivial little ad banner with some animated effects: my PowerBook's 2 fans start up immediately and the system is maxed out at 100% CPU load. Everything else on the machine becomes so slow, it's almost standing still, and the only cure is to close the page containing that Flash movie.
Most Flash content on normal web pages is advertising. It's a nuisance, but there are ways to get rid of it. In Camino, for instance, Flash content has to be manually activated by default (until you click on it, a placeholder is displayed for every Flash movie). For Safari, there is Safari Stand which adds a similar blocking functionality.
[Update 20090227: There is a webkit plug-in (for Safari et al.) called clicktoflash that does exactly this: github.com/rentzsch/clicktoflash/tree/master]
But what about pages you visit explicitly for looking at their Flash content? The most obvious example is YouTube. Whenever I want to check out some YouTube clips, I have to live with my Mac becoming an expensive desk calculator, because that's about as much as it can be used for while playing FLV movies.
My PowerBook G4 is almost 5 years old now, but Flash performance still sucks even on those newer machines that are about 5 or 6 times as powerful as mine. Why is that? Sloppy coding? Is the Flash plug-in developed on Windows and then half-heartedly ported to OS X? Or is it a conspiracy by Adobe who are secretly controlled by Microsoft to kill the competition?
In a comment further down on that page, someone wrote:
[...] Even with Flash Player 10 beta 2, the performance under OSX is approximately half that of Windows XP. It is approximately 28fps under OSX and around 58fps under Windows XP.
So even the very latest version of Flash Player 10 under OSX is about half the speed of Windows!
The frustrating thing is that Adobe has not given any clear reason to account for the lack of performance.
Another puzzling thing is that Adobe is now saying that the text rendering has been very slow in the past, it has now identified the bottleneck and fixed it. But why has this bottleneck taken so long to find? The implication seems to be that no-one at Adobe has even tried to sort out the performance problems by profiling the code.
So with no explanation for the dramatic difference in speed on the same hardware under different operating systems, it is beginning to look like Adobe not only does not know why there is such a dramatic speed difference, but it has never made the effort to find out.
So Adobe - any answers as to why OSX is STILL so slow, or has no one
done the work to identify the problem?
To which the blog author replied:
[...] Please read my comment on the GUIMark site. I was very clear about why there is still a difference. The standalone player is only about 10-20% slower than the windows version with this specific benchmark.
This rest can be attributed to gcc. Even Apple has had finally enough and is starting to develop a replacement based on LLVM: developer.apple.com/releasenotes/DeveloperTools/RN-llvm-g... (I said starting, this is not even close to being production ready)
"But why has this bottleneck taken so long to find?"
Because this benchmark hits a very specific area in the player which can't be seen with real content. GUIMark is a benchmark, not real content.
For the record I, other developers and QE run Shark and other
performance tools, manually and automated. All the time.
So it seems my cynical fears of conspiracy or Adobe maliciously ignoring performance of Flash on OS X are unfounded. They are in fact trying to make it run as fast as possible everywhere, but they are not doing as well as on Windows. The reasons are pretty technical, as that same blogger explains in his comment on the GUIMark site (which he refers to in the above reply):
We have identified the bottleneck in the Flash Player for OSX. Like in the other plugins the culprit is text rendering, in this case rendering using device text. This benchmark spends >50% in a single OSX function: ATSUGetUnjustifiedBounds. You can verify this yourself using Shark. I am working on a change which will cache the results returned by that API to where this call should completely disappear from the performance profile.
Googling for the function in question brought me to a page from Apple's developer documentation on which it says:
Note: Although the function ATSUGetUnjustifiedBounds (formerly named ATSUMeasureText) returns the typographical ascent and descent values, using this function to obtain ascent and descent values might degrade performance. You should not use ATSUGetUnjustifiedBounds to obtain these values.
So – sloppy coding, after all?
The above screenshot is the performance graph of my machine running the GUIMark benchmark. Current windows PCs run this same benchmark at about ten times the speed. It's frustrating, but it seems things will get better.
By the way, the performance of Flash on OS X is the reason why the iPhone does not play Flash content within web pages, and why there is a special application just for YouTube (which probably uses a specially optimized decoder and player for Flash video (FLV) data, but cannot play Flash movies per se.)