You are not logged in.

#1 2010-07-25 15:41:42

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Whence comes Flash's resource hogging?

Flash is a pig. We all know it's a pig. It uses ten times as much CPU time as VLC or MPlayer, to play a movie that's maybe 480x340 pixels.

I figured for a while this was just bad coding, or Adobe not caring about bugs, or something. But there's clearly more to it than that, because all the Flash alternatives are even worse.

- Gnash uses at least 50% more CPU power than Adobe's plugin
- swfdec kicks it up to 99%
- And Lightspark... well, it barely uses any CPU, but doesn't render video on my machines because the hardware is incompatible! From what I've read about it, all it does is transfer the load from the CPU to the GPU.

So I shall ask in very simple terms: where on Earth is this load coming from?

If you had some kind of kludged up Java applet that would render interactive control widgets, and invoke an external decoder to play the movie, or something like that... I cannot see how it could possibly use as much CPU as a Flash video. Might use a lot of RAM, and take a long time to start; but once it got going I simply cannot see how it could be so CPU hungry.

Is there something I'm not seeing here? Is the SWF format designed in such an inefficient way, perhaps, that it is impossible to parse without CPU churning? Does anyone know the explanation?

Offline

#2 2010-07-26 07:06:33

PirateJonno
Forum Fellow
From: New Zealand
Registered: 2009-04-13
Posts: 372

Re: Whence comes Flash's resource hogging?

i'm not an expert, but i'd guess its due partly to actionscript, which is like java but much, slower (and I'm not suggesting java is fast), combined with CPU decoding and rendering. Not even sure if it uses Xv, let alone opengl or va-api/vdpau


"You can watch for your administrator to install the latest kernel with watch uname -r" - From the watch man page

Offline

#3 2010-07-26 07:43:03

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

Re: Whence comes Flash's resource hogging?

This might shed a little (rather tiny wink ) bit of light on the matter: http://en.wikipedia.org/wiki/Adobe_Flash#Performance

@Gullible Jones: Browncoats rule!!!

Offline

#4 2010-07-26 10:14:50

Gusar
Member
Registered: 2009-08-25
Posts: 3,606

Re: Whence comes Flash's resource hogging?

I already explained this in some other post. It's because Flash needs to do colorspace conversion and scaling in software, so that it can draw the UI on top of the video. The solution is hardware decoding and drawing (VDPAU, VAAPI), but that would require more commitment from Adobe than having one single guy working on the Linux version of Flash.

Offline

#5 2010-07-27 03:25:12

iBertus
Member
From: Greenville, NC
Registered: 2004-11-04
Posts: 2,228

Re: Whence comes Flash's resource hogging?

\hijack
This becomes less relevant with increased number of CPU cores. For example, I can watch 1080p Flash video on my machine and only use 12.5% total CPU. I don't even notice that flash is running. In the future this will be the case for most systems as manufacturers cram 8+ cores onto a die and prices drop. Plus, we all know that other technologies are going to replace Flash in the next five years.

What has always been a bigger concern to me is the sudden slowdown that any I/O load causes on 64-bit linux. Why has this not been addressed upstream? Geez... I can run something simple like a loop with ImageMagick to convert a directory full of images and it brings the entire system to a
crawl. Even the mouse cursor is slow to respond! And I know that others are having the same issue as it's a common question on internet forums.

\\hijack

Sorry, couldn't resist.

Offline

#6 2010-07-27 03:40:07

alexandrite
Member
Registered: 2009-03-27
Posts: 326

Re: Whence comes Flash's resource hogging?

Gullible Jones wrote:

Flash is a pig. We all know it's a pig. It uses ten times as much CPU time as VLC or MPlayer, to play a movie that's maybe 480x340 pixels.

I figured for a while this was just bad coding, or Adobe not caring about bugs, or something. But there's clearly more to it than that, because all the Flash alternatives are even worse.

- Gnash uses at least 50% more CPU power than Adobe's plugin
- swfdec kicks it up to 99%
- And Lightspark... well, it barely uses any CPU, but doesn't render video on my machines because the hardware is incompatible! From what I've read about it, all it does is transfer the load from the CPU to the GPU.

So I shall ask in very simple terms: where on Earth is this load coming from?

If you had some kind of kludged up Java applet that would render interactive control widgets, and invoke an external decoder to play the movie, or something like that... I cannot see how it could possibly use as much CPU as a Flash video. Might use a lot of RAM, and take a long time to start; but once it got going I simply cannot see how it could be so CPU hungry.

Is there something I'm not seeing here? Is the SWF format designed in such an inefficient way, perhaps, that it is impossible to parse without CPU churning? Does anyone know the explanation?

It's because in reality, the fine folks at Adobe are brilliant programmers.  A good programmer could make something that does what Flash does with less than half the resources.  A bad programmer could do it with 75%.  But to make something as horrible and slow as Flash Player run as horribly and slowly as it does takes real talent.

Offline

#7 2010-07-27 04:16:21

Acecero
Member
Registered: 2008-06-21
Posts: 1,373

Re: Whence comes Flash's resource hogging?

alexandrite wrote:

It's because in reality, the fine folks at Adobe are brilliant programmers.  A good programmer could make something that does what Flash does with less than half the resources.  A bad programmer could do it with 75%.  But to make something as horrible and slow as Flash Player run as horribly and slowly as it does takes real talent.

A good programmer could also write Flash Player that would take up 90% system resources. tongue

Offline

#8 2010-07-27 04:25:26

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Whence comes Flash's resource hogging?

Of course, hardware acceleration would help dramatically. lightspark uses almost no CPU power on this machine. Granted that it's still in the early stages of development, but where it works, it's kicking the crap out of all Flash-like implementations in terms of perfomance.

Offline

Board footer

Powered by FluxBB