Hacker News new | ask | show | jobs
by hmottestad 5351 days ago
Running on a macbook pro with i5 dual core 2.4 ghz, it uses 1 core at 100% in firefox and manages:

1.7 fps

It's cool, but I don't see any real world applications. Anyone got any ideas?

5 comments

You need Firefox nightly for it to run well, because it depends on the hybrid static/dynamic type inference work and some other optimizations. I believe that Brendan was demoing it from a Mac laptop of some kind.

As far as applications, it will let content providers who want to ship H.264 and pay the license fees do so without requiring all browser developers to pay such fees. (For Firefox it would be a meaningful portion of Mozilla's engineering budget.)

And it's a pretty compelling demo, IMO, of the fact that we're not done with JS performance yet, and that people don't need to be running to Dart or NaCl or other rip-and-replace technologies in order to get great perf. There's a lot of opportunity for even better performance on the engine side as well as the library side: they started a week ago with emscripten, Closure and the libstagefright C sources...

1. This works much faster on Firefox nightly (that's where we demo'd it on). Nightly has a lot of JS engine improvements that are not in stable yet (but will be in a month or two).

2. This does not use any hardware acceleration yet. This is simply compiling the Android C decoder into JS, nothing else - just a few days of work. We will now start to look at actually optimizing the code specifically for JS, and also to use GPU shaders for the relevant part of the code. Both of those can potentially make this even faster.

Regarding real-world applications, the interesting possibility is for websites to ship their own codecs. As I mentioned in a comment above, imagine an anime video website that ships a video decoder optimized for that kind of content - it could be much more efficient than stock H.264. Also, if websites can ship their own decoders, they can continually improve them (unlike now where websites rely on client decoders which are not constantly being improved).

With today's Nightly I'm getting ~20fps on a 3.4 GHz Core i7 iMac but with drops into the 7fps range on some video transitions. Surprisingly, I get roughly the same perf with a current Aurora as well but the drops only go down to ~12fps. Trying it on the released Firefox gets around 2fps.
I think it's more of an (impressive) mental exercise - if the code can be made straightforward enough to run on javascript, the future applications can only grow from there.
It's the Android encoder written in c++ cross compiled to JavaScript, not much of a mental exercise. Not to say it's not cool :)
They have a hand-coded javascript version in progress too:

https://github.com/mbebenita/Broadway/tree/master/Play

Strange.. It was running at 4 fps on my Pentium 4 lol
hmmm....

What browser, OS and what Pentium 4 processor? And for how long did you run the video?

Mine drops to 1.7 after a few seconds, the first few frames are dark so in the beginning I get 6 fps.

Nightly, XP, 2.4 Ghz. Nearly 5 Minutes.. Here it starts at like 0.6 fps, and then runs at 4-7 fps onwards.
Must be something with Nightly then, I'm just running the regular version.

Says a lot about the importance of software over hardware :)

It definitely needs nightly. I'm not sure what's up with salmanapk's setup, will need to dig into it.