Javascript possibilities, asm.js

Hello everybody! This one is about javascript, not OF!

I work as a front end developer and I have found the asm.js project very interesting. For what I’ve read it is an subset of javascript that is meant to be more efficient and fast. John Resig seems to be very excited about asm.js and has written a post about it:


The first video on that post shows a port of the Unreal engine to javascript. Whoa!

Apparently Firefox is going to support asm.js optimization, and Chrome, probably, too.



Interesting news, I think, and new and juicy possibilities for graphic programming in javascript.


I’ve been excited about asm.js too! I recently used it on with conditionally-awesome results.

Right now it works only on nightly builds of Firefox. So, it should be in release versions of Firefox soonish. I’m not sure when it’s coming for Safari or Chrome though. Since asm.js is just a special subset of JavaScript that’s easier to optimize, the code still runs on browsers that don’t support asm.js, but I did have some problems with my asm.js version not running as fast as the non-asm.js version in Safari. To get around that, I ended up having to bite the bullet and maintain both an asm.js and a non-asm.js version of my renderer :frowning:

The spec is really intended as a format for automated tools like emscripten, but it’s not that bad to write it by hand if you have only a small inner-loop that needs optimizing. I chose to write most of my app in CoffeeScript, with a small computation kernel in hand-written asm.js that runs on a Web Worker thread.


It’s great! : ) I’ve tried it on Firefox Nightly and on Chrome, but I couldn’t appreciate any performance differences. Are you using the non-asm.js version of the renderer?. In any case, I love it: it is brilliant (he, he).



On both of those browsers it should be choosing the asm.js version of the renderer. I’ve found the asm.js renderer on Firefox Nightly to be about 2x the speed of the old renderer. On Chrome it was just slightly faster (maybe 10-20%). But the speed will depend a lot on where the bottlenecks are. Depending on your machine, it could be memory bandwidth, floating point performance, or Javascript VM performance.