

Flash is a CPU hog? - Sindisil
http://www.mikechambers.com/blog/2010/05/10/top-flash-misperceptions-flash-is-a-cpu-hog/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+MikeChambers+%28Mike+Chambers%29

======
mdasen
The reason that people are hammering at Flash so much is that there's one
implementation of Flash and, for years, Adobe and Macromedia actively tried to
stifle alternative implementations. Why does this matter? Over time, when
there's competition between implementations, they all tend to get worked on
and improve. Look at Apple's JavaScriptCore and Google's V8. Heck, even
Firefox has improved JavaScript performance a lot compared to previous
versions and Internet Explorer. The competition is so important that Microsoft
has put a lot of effort into IE9 making JavaScript a lot faster there.

Right now, most implementations of HTML5, Canvas, and SVG aren't so fast. I've
seen demos that show them getting fewer frames per second than Flash for
animations. But the point is that they're open technologies whose
implementations can and will improve. Flash has been a closed technology for
so long and Adobe has taken that lack of competition and ignored performance
concerns.

With video, it's the same situation. While browsers might not be using less
CPU right now playing H.264, there's the potential for better decoding in the
future. VLC uses very little resources on my Mac decoding H.264 video. It's
not merely Safari's access to hardware acceleration since VLC doesn't use
hardware acceleration.

The problem with Flash is that it doesn't allow companies like Apple, Mozilla,
Google, and even Microsoft the opportunity to increase efficiency; it doesn't
allow an army of volunteers to improve a code base. It's just stagnated since
there was no other way to do animation and vector graphics until recently.

The problem with Flash isn't where it is now in comparison to other
techniques. The problem with Flash is that the other techniques are open and
improving at a rapid pace while Flash isn't. The problem with Flash is that
open technologies have lots of smart people working to improve them and make
their implementations better while Flash is remaining much the same.

Our objection to Flash is that we can see what happened with JavaScript and
Ajax (from apps like Google Maps and Gmail to toolkits like jQuery and
Prototype) happening with vector images, animation, and video if there's an
open standard that all companies and individuals can freely implement and use;
with Flash, all we can see is Adobe continuing to feed us the same product
we've had for years.

~~~
not_an_alien
Flash is not "remaining the same". Vast improvement has been done both in
terms of features and performance in the past years -- many of them, yes,
requested by the community - but I guess anyone who's not working closely with
the technology won't be able to see it.

There's a lot of future predictions in your post. It's funny that people are
changing their assumption that HTML5 _us_ faster to that it _will_ be faster
eventually. Let's see how well this pans out. In the meantime, Flash will
continue to evolve.

Good luck to everybody.

~~~
Detrus
Since the Flash 9 release in 2006 that came with AS3 there were only minor
improvements. So the rapid development of the previous years did not last. The
past did not predict the future.

The new 3D API is maybe a 30% improvement in performance, it's mostly an
improvement in swf size. Typed arrays rarely help. PixelBender looks like an
early implementation, not a well supported feature. Alchemy isn't officially
supported either, but it does some tasks well.

These hacky features took years to appear, so Flash isn't evolving any faster
than browsers at this point.

------
not_an_alien
Not sure what's the gist of the test -- all this proves is that it's possible
to achieve 100% CPU usage in HTML, and that some browsers perform better than
others. How does that relate to Flash?

I guess my point is that it's missing some real benchmark. So here's some.

Desktop FP 10.1 vs Canvas <http://vimeo.com/10553088>

Android FP 10.1 vs Canvas <http://vimeo.com/10553088>

GUIMark 2 <http://www.craftymind.com/guimark2/>

I look forward to more benchmarks like these in the future.

~~~
raimondious
From the article,

Re: real benchmarks

 _If you are interested in a more direct comparison of performance between
various multimedia technologies, then check out the tests done at
themaninblue.com [<http://themaninblue.com/writing/perspective/2010/03/22/>].
This is one specific test but it shows that if anything, Flash performance is
on par (if not better in some cases) with comparable technologies._

and

Re: what does this have to do with Flash?

 _So, when looking at Flash CPU usage compared to other multimedia
technologies, then no, Flash does not use an inordinate amount of CPU. While
Flash content can at times use high amounts of CPU, this is a result of the
nature of the content, and not necessarily specific to the Flash runtime._

Edited with some original content: I think he has a good point that there's a
lot of blind anti-Flash rage without actually thinking about what Flash
competes with. Yes it's better to design websites so they don't tax your
processor, but we're probably going to see the same issues people peg Flash
with when sites use open alternatives for multimedia.

------
QE2
A product that has been actively developed for over 14 years had sure as hell
better be able to say something more than "our performance is on par with" an
emerging technology that is still being developed and isn't even standardized
yet.

~~~
Qz
14 years of development can't do much against the fundamental complexity of
whatever the product is supposed to do.

~~~
InclinedPlane
So, does that mean that you are implying that the irreducible complexity of
tasks which were non-taxing to 15 year old computers in the early cd-rom
"multimedia" era (e.g. various 2d animations and interactivity and video) in
some way fundamentally require 100% CPU usage on modern multi-core multi-
gigahertz processors?

Frankly I don't buy it.

~~~
Qz
No that is not what I am implying, although it is a valid fault with nearly
_all_ of the software we run on personal computers, not just Flash.

------
Detrus
Flash as a CPU hog is a user complaint. Users do not care how it compares to
other similar technologies and this narrow metric won’t convince any of them.
This was a fixable problem that wasn’t fixed.

Flash is no longer the king of easy to make visual extravaganza. It was
apparent to those who used Flash because they couldn’t pile on extravaganza
effects like they saw in Processing. Flash did not even address their concerns
for years, if they listened to core users the performance complains from the
rest of the web would have resolved themselves.

Flash should have had hardware acceleration added years ago (not just for
video) because it was commonly used to display very taxing animations.
Multiple out of view banner ads were a common use case, Flash had no built in
ability to disable out of view banners that did not need to run, or API to
enable background tasks that needed to be run. Most banners were made with AS2
and Flash still does not have an auto updating mechanism apart from Chrome.

HTML5 Canvas will get hardware acceleration eventually, WebGL will have it
from the start. The difference is Flash was around for years doing those
things, shoving ever more taxing animations while ignoring usage scenarios and
the economics of Flash projects. (where developers satisfy clients, not users)

I expect browsers will pay more attention to usage scenarios, since they make
their money when people use the web, Adobe makes it from selling tools.

tl;dr – If Flash or Canvas feel like CPU hogs that needs to be fixed, whatever
it takes. Put in CPU usage limits, don’t let people compile CPU hogs, APIs for
background tasks, add 20MB of hardware acceleration to the runtime, contribute
to WebKit, Firefox, NativeClient to get it resolved. Should have prioritized
this earlier, now kiss your penetration goodbye.

------
bonsaitree
Yes, it is. Any kind of non-hardware-accelerated video playback will be CPU-
intensive. The MAIN point is that Flash is MORE CPU-intensive for a given
frame-rate, color depth, and resolution than comparable codecs.

Comparing open, fresh-off-the-vine, HTML5 animations to a decade-old
proprietary implementation like Flash is also a non-starter.

On the plus side, Flash videos currently make great, handy fan-speed servo
tests for any Mac laptop.

~~~
Qz
You clearly know little about flash if you think its still using a decade-old
implementation to do animations.

Additionally, flash uses HW acceleration where available, so your first point
is moot.

~~~
KirinDave
Or rather, it WILL use them soon. Mac HW acceleration isn't fully deployed
yet, is it?

It seemed to me like the article is, "Well yes there are these problem areas
but there is an alpha that fixes them, so the entirely line of criticism is
bunk." Obviously I do not agree.

It's good that Flash is finally getting comparable video playback performance.
It's bad it took this long. And I also question why most people care. Flash,
no flash... all I care about is video. If Flash is an impediment, let's dump
it. Does that make a few Flash developers sad? TOO FUCKING BAD. This is an
industry where change is a constant, if you wed your career to a technology
you've made a fatal mistake.

~~~
Qz
"Or rather, it WILL use them soon. Mac HW acceleration isn't fully deployed
yet, is it?"

Hence _where available_. And it wasn't available on the mac because Apple
hadn't opened up the APIs to do it.

Your summary of the article is pretty poor -- that was one statement, the
majority of the article was about the fact that critics often cite Flash as a
CPU hog when comparing it to things that by default are not CPU hogs (static
html).

Second, if video was the only thing Flash did, it would already be dumped.
Flash does a lot more than that. The reason video is the linchpin is that it's
taken innumerable years for standardized video access, whereas Flash provided
it cross-platform. Sure you complain about Flash now, but the web wouldn't be
where it is now without it.

~~~
chaostheory
"Hence where available. And it wasn't available on the mac because Apple
hadn't opened up the APIs to do it."

VMWare and Parallels were able to use HW accelleration right? Why can't Adobe?

~~~
Qz
VMWare and Parallels do very different things than Flash does. My (uninformed)
guess would be that it has to do with the security sandbox. The kinds of
things you would run on VMWare (installable applications) is very different
than what you typically run in Flash (whatever random dreck you happened to
stumble into on the internet :P).

~~~
KirinDave
It's much easier to do hardware accelerated 3d drawing with a toolkit for an
interpreter than it is to make a full virtualization layer properly do
hardware acceleration.

Your opinion is indeed uninformed. Fortunately for you, correction is easy to
get on the internet.

------
mrinterweb
The reason people perceive Flash as a CPU "hog" is because there are a lot of
script kiddy flash programmers out there that will write the equivalent of an
infinite loop in their banner add. I've been in the trenches and seen some of
the horrible ActionScript code. The same thing can happen with bad javascript.
Flash GUI tools tend to attract non-programmers so they can make pretty stuff.
Too bad it does not tell them that they have just created something that will
crash everyone else's browser.

Maybe if Flash's run time encapsulated the Flash instances and made them
behave, this would not be an issue.

------
jwegan
Part of the problem with flash is that when it is crunching away executing
some code, it is unresponsive to GUI events. One way around this is to break
up computation by using a chain of events to complete the computation which
allows GUI events to be interleaved thus making the application more
responsive.

------
Judson
I think the main point is that for _video_ flash is more taxing than a
hardware decoded html5/x264 (at least on the mac because flash video doesn't
use hardware decoding).

~~~
necubi
Except that it's also much, much more taxing on the Mac than other non-
hardware decoding players. What seems seldom noted in this discussion is that
the only OS X video player that supports hardware decoding is Quicktime X.
Anything else—earlier versions of quicktime, VLC, MPlayer—uses software
decoding. Despite this fact, those three options place half or less CPU load
on my MacBook's processors than flash video does. As a quick test, a 720p h264
video running in VLC (software decoding) uses 35-50% of a CPU. 720p youtube
using Flash 10.1's new hardware decoding support, uses >100%. That's simply
unacceptable for fundamentally doing the same thing.

Flash performance on the Mac is terrible and hardware decoding is a red
herring. I think a lot of those defending Flash's performance use Windows,
where performance is much better.

~~~
wmf
[http://blogs.adobe.com/penguin.swf/2010/01/solving_different...](http://blogs.adobe.com/penguin.swf/2010/01/solving_different_problems.html)

~~~
necubi
The only thing that article convinced me of was that Flash is not a good
solution for playing streaming video, because it has other priorities and must
make concessions to those. But isn't that what the anti-flash crowd has been
saying all along? Other video players may have an easier time providing good
performance, but they still can get better performance. If Adobe is happy
solving different problems they should accept that their customers who have a
problem Adobe doesn't solve will be looking towards other solutions.

There's also the sticky issue of vast performance differences between windows
and OS X/linux on the same hardware, but even if we accept your thesis that
this isn't really Adobe's fault, it doesn't excuse the poor performance.

------
twir
I didn't see anything in that post that disproved that Flash is a CPU hog.

I work with Flash and AIR apps on a daily basis, and I can tell you that
invariably by the end of the day my browser's Flash plugin is using the
majority of my CPU time and RAM.

~~~
Qz
The point is, CPU hog compared to what?

~~~
nvoorhies
If it's using the majority of the CPU and memory, then the answer apparently
is "compared to everything else".

~~~
twir
Exactly. If it's hogging the CPU, it's hogging the CPU--it's irrelevant if
it's more or less a hog than something else really.

Truth be told, I'm only running a Mac Mini. That being said, iTunes seems to
be more efficient at streaming audio, video. Other desktop applications seem
to do a better job at graphics in general.

I guess part of the performance hit one experiences with Flash is due to the
overhead of a nice cross-browser, cross-platform, web-oriented runtime. Java
applets, which do more or less the same thing, are also pitifully sluggish, in
my experience.

~~~
Qz
It's more than relevant whether something hogs a CPU compared to another
program that does an equivalent thing. No one complains when Crysis hogs the
CPU, because we all expect 3d games to hog the CPU. People complain when Flash
hogs the CPU, but seem to forget that HTML5/JS apps that do equivalent things
often hog the CPU just as much, if not more. _That_ is the relevance.

~~~
twir
Good point. I guess it does depend on context and the purpose of the app.

------
corysama
I recently tried out a demo of a "high-speed" side-scrolling game library for
flash. It ran OK, but not terribly impressive considering how little was going
on. But it seemed really familiar somehow... Eventually I realized that it was
nearly identical in both content and performance to a Univesa (like DirectDraw
for MS DOS) demo that I ran on my Pentium1 60Mhz back in 1996.

------
westbywest
I would be curious to see how the same benchmarks pan out for running flash on
some of the popular Linux distros, e.g. Debian, Ubuntu, Red Hat. I write from
the assumption that Adobe sees little incentive in ever releasing decent flash
support for Open Source OS's, but a quantitative comparison would at least be
informative.

~~~
not_an_alien
From a comment in <http://themaninblue.com/writing/perspective/2010/03/22/> :

 _mine is: (ubuntu 9.10, core 2@2.4Ghz)_

 _on FF3.5: flash 25 FPS, canvas: 16FPS, svg: 2FPS_

 _chrome: flash 26, canvas, 12-15,svg:13_

I suspect the guy is running the beta x64 version of FP10 for Linux though, as
other people are having lesser ideal results.

------
reitzensteinm
What about a "disclaimer, I'm an Adobe employee" in the post? It's kind of
obvious that he is, and a quick look on the About page confirms it, but I find
it more than a little dishonest that he's talking about his employer's
technology without disclosing that fact.

~~~
colonelxc
If you look at the front page of his blog, you can see that he's blogging
about flash quite frequently. For any normal viewers of his blog, they will
already know about his Adobe connection and the stances he will take with
flash. We're just in the unfortunate position of popping in for this one blog
posting.

One solution would be if he had a brief bio in the sidebar beside each blog
entry, but otherwise I would not expect him to put a disclaimer on each post
he makes.

------
thecombjelly
Amongst my friends, the joke is that you need at least two cores, one for
listening to music on Pandora and one for other things. On my quad core phenom
II (Linux) Pandora uses nearly a whole core. There is nothing within Pandora
that justifies such cpu usage. Same goes for video. A youtube video shouldn't
be using 25% cpu (one core) on a decent quad core. (Note: windows and other
variations have better CPU performance, but in Linux world Flash has never
been very decent).

~~~
tmvphil
If you're interested in pandora without flash, you might want to check out
pianobar - <http://github.com/PromyLOPh/pianobar> \- it has pretty much all of
the functionality without the overhead.

------
kqueue
Have you heard the CPU fan when watching a video using flash?

~~~
pavs
No one believed me and people actually thinks I am being snide towards
Apple/Adobe when I told them during winter, when my heater was not working so
good for one week I would play a flash video on my macbook and put my palm
under the laptop to keep myself warm. Yes, it does indeed gets that warm and I
am not joking.

~~~
psranga
Real men/women run a C program doing floating-point divisions (to peg CPU)
while writing random bytes to memory (to heat up caches) to keep warm. :)

~~~
pavs
Watching kitty videos adds to the warm and fuzzy feeling during winter that I
doubt floating-point divisions can do.

------
stevek
As anybody with a netbook can tell you that many videos which are extremely
choppy in flash (yes, even if fully buffered) are quite playable in vlc for
instance.

Now given that one of the main uses for flash is streaming video, that should
simply not be the case.

------
icefox
My metric: When I installed flashblock my laptop battery life went up by a
significant amount.

------
jrockway
C is slow! "while(1){}" uses 100% CPU! In conclusion, Flash is awesome.

------
earl
Mike's an adobe employee. Obviously. Here's the problem for Adobe -- it's not
just apple / apple employees / apple devs that despise flash. The performance
sucks ass, no matter what deluded blog posts they publish. I know this because
flash runs on my computer, and I'm gonna believe my lying eyes over their
nonsense.

Instead of having employees run all over the web lying about flash performance
when people see the truth right in front of them all day long while using the
internet, perhaps he and adobe should try fixing things? Just a thought.

~~~
donaq
I second that. Using Flash to simply play video on Linux/Firefox drives my CPU
up to 100%. No matter what benchmarks or graphs you contrive to show me, I can
HEAR my box's fans getting loud.

------
dfox
From my point of view, problem with flash is not that it uses inordinate
amounts of CPU time when doing something "useful", but that it consumes
incredible amounts of CPU event when it does nothing. On my laptop, there is
clear correlation between opening something like youtube video and firefox
taking 99% CPU few hours later and refusing to even close (and requiring
restarting by means of "killall firefox-bin"). Every time when I had to
forcibly kill firefox without flash plugin I was able to find some reason why
it had hanged (and in most cases it simply hanged, not consumed 100% CPU),
like malicious JS code.

Also, flash is only thing that is reliably broke by suspend to disk on my
laptop.

So for me, there is not room for improvement in flash, but flash is simply
broken piece of crapware.

~~~
Detrus
Here is a fix that could have been done long ago to reduce CPU usage
<http://www.kaourantin.net/2010/03/timing-it-right.html>

It took a lot of whining for them to get started on it, but there was and is
plenty of room for improvement. The argument about heavy media using a lot of
CPU in HTML5 and bad developers who don't care about users only goes so far.
Ultimately, Flash is what's being used for CPU hogging sites, Flash developers
are the ones pushing the boundaries on a large part of the web, and the makers
of Flash need to keep up with their developers.

When Canvas or JS becomes annoying it will be up to browsers to fix it,
include click to Canvas, do whatever it takes so users keep using the web. If
they fail at this, they'll have a hatefest coming their way.

