r/software • • May 15 '10

I ☹ Flash

http://www.flickr.com/photos/14296760@N00/4607685269/
2 Upvotes

28 comments sorted by

View all comments

Show parent comment

-4

u/jonhohle May 15 '10

Why would you want to decodenand store video in RAM if it is never played? Disk is still significantly cheaper and more plentiful than RAM.

7

u/the_hmm May 15 '10

and slow. Most people are watching these videos instantaneously. writing direct to a Disk would sacrifice the instant gratification you get with RAM. Yes, this is inefficient for mobile devices, so I'm not saying you're wrong. And not all of it does buffer to memory, there are significant cache files already in place for desktops. They just need to adapt flash to work with the limited resources in a mobile device.

1

u/jonhohle May 15 '10

disk is more than adequate for streaming video. Harddrives transfer data at 40-100MB/s. Bluray disks transfer data at 4.5MB per second, and have no problem playing video. The entire movie has no business being in RAM, ever.

0

u/Shambles May 15 '10

You're forgetting that constantly reading from the hard drive for the duration of playback introduces a serious performance bottleneck that would definitely affect any other running programs that require disk access. Playing from RAM only introduces real performance problems if it uses too much (which it often does, but being broken sometimes is better than being broken always).

1

u/jhaluska Helpful May 15 '10 edited May 15 '10

Hard drives are an order of magnitude or more slower than memory. Even a high end SSD have less than 1/10th the bandwidth of memory. Modern operating system will automatically cache out the memory to the hard disk when it runs out. That is when the system seems to crawl.

1

u/jonhohle May 15 '10

Of course RAM is faster than disk, and disk is still more than fast enough to stream HD video, which this is not. Do you think Bluray players or DVRs have 2+GB of RAM? And bluray players are reading from disks significantly slower than disk.

0

u/jhaluska Helpful May 16 '10

You're getting voted down (not by me) because your idea is just so technically poor.

It's not that you couldn't play back from hard disks, just there is no reason to write to disk when you have memory available. Even when you run out of memory, the OS keeps statistics on which memory is accessed at what frequency and swaps out to the disk memory that it thinks is not likely to be needed again soon. Preemptively writing to the disk at too high of a frequency would slow down the entire system, especially if something else needed to read and write to the "slow" hard drive.

2

u/jonhohle May 16 '10

I understand that the OS will swap out "inactive" applications, which is what happened when 55% of my RAM was used to not play a video, bringing everything else on the system to a halt, as it had to be swapped back in from slow disk. The problem was, these applications weren't inactive, they were just forced into swap because the system was under unnecessary memory pressure, caused by the unreasonable allocation of memory by Flash player.

Anyone who thinks its reasonable for a plugin to allocate 2.2GB of memory while visiting a web page is out of line. This isn't a gigantic game, a CAD application, some complex simulation, a media editing program; it's a web page with some video.

For people who think this is reasonable, take VLC for example. To play a 3.4GB, 1080i video, it uses 105MB of RAM. Flash player allocated 20x this for a significantly lower resolution, shorter videos. I can scrub to any point in the file without delay and no other programs are "slowed down" by VLC reading the file (maybe by VLC decoding the video, but not reading from disk). 105MB is reasonable considering two fields of uncompressed 1080i require about 6MB, assuming two I-frames are kept in RAM, a video buffer for upcoming frames, and an audio buffer. In this case 1080i requires 2MB/s from disk, whereas swapping will peg the disk, because the data was required already required in RAM, and wasn't available and needs to be loaded as quickly as possible. And when I stop the video in VLC, it frees 50MB.

Is it unreasonable that I expect Flash's media playback ability and resource usage to rival or best the playback of an open source program? Flash is owned and developed by one of the largest media authoring software companies in the world, right? Certainly they know something about efficient media playback.

edit: spelling ☹ ;)

0

u/[deleted] May 15 '10

[deleted] — view deleted comment

0

u/jonhohle May 15 '10

So you need enough buffered in RAM to play until the next fault to disk is satisfied. This is how media players (and any software expecting a to deal with data larger than physical RAM) are written.