

Asm.js performance improvements in the latest version of Firefox - matt42
https://hacks.mozilla.org/2014/05/asm-js-performance-improvements-in-the-latest-version-of-firefox-make-games-fly/

======
comex
Not bad. On a related note, it seems that with FTLJIT, Safari now beats Chrome
(V8) and Firefox-without-asm.js on asm.js benchmarks:

[http://arewefastyet.com/#machine=12&view=breakdown&suite=asm...](http://arewefastyet.com/#machine=12&view=breakdown&suite=asmjs-
apps)

This is great news for anyone for whom V8 was already good enough, although
Safari's still handily beaten by Firefox with asm.js mode, which is handily
beaten by native. I wonder whether Apple is interested in implementing a
special asm.js mode for Safari, which, LLVM being LLVM, might surpass Firefox.

------
jffry

      together with all the other work on optimizing
      asm.js, allows it to run at around 1.5x slower
      than the speed of the same C/C++ when compiled
      natively
    

Running at 67% of native speed, and backwards compatible with all non ASM.js
browsers? That's pretty great!

~~~
hippich
I am working on a project based on asm.js technology. From my experience very
limited and simple asm.js code might be compatible with "all non asm.js
browsers". In particular I found IE9 wouldn't work with some compiled code.
IE10 so far so good (but slow of course.)

~~~
nnethercote
asm.js relies on typed arrays, and IE9 doesn't support them. So I'd be
surprised if IE9 was able to handle any asm.js code.

~~~
azakai
Emscripten can emit code without typed arrays. It's fairly slow but does work
in IE9.

~~~
hippich
Yes, you are right, but I found back then that not all code can be compiled
without these arrays. Can't remember why right now tho. So there are certainly
issues with browsers not supporting typed arrays.

~~~
azakai
Yes, it is tricky to compile without typed arrays. It means we need to disable
LLVM optimizations, and also a lot more undefined behavior in C will fail
(anything that assumes memory aliasing).

With a little effort stuff can be ported, I ported CPython that way. But typed
arrays is far better.

------
erichurkman
That asm.js demo of Angry Bots [1] is damn slick. In Chrome (2013 macbook air)
it's a bit choppy, but on Firefox 30 beta it's very smooth.

[1]
[http://beta.unity3d.com/jonas/AngryBots/](http://beta.unity3d.com/jonas/AngryBots/)

~~~
camus2
works well on FireFox even with an old computer,but yeah it's a catastrophy on
Chrome or IE.Good for Firefox that could become the Gaming Browser. Bad for us
devs that will have to learn C++ to get good perfs out of game,because you
cant write asm.js by end.

~~~
Ygg2
Eh, it's possible to write asm.js just much harder than regular JavaScript.

Keep in mind Operating systems were written in assembly, asm.js is not as bad
as assembly in some regards.

~~~
camus2
I'm not writing an operating system.The point is you cant get these perfs with
using regular javascript.ASM.js is not regular javascript,since it's a subset.

~~~
Ygg2
No, but this operating system is the example of most performant, least
resource hungry application I can think off. If you need performance you don't
write C, you write assembly. Same with asm.js.

~~~
pjc50
You try to avoid writing in assembly unless you absolutely have to, because
it's a big maintenance pain _and_ unless all your assumptions are correct it
may not be as fast as the compiler.

It's not worth bothering with unless you're vectorising or want to use some
other instructions that are not normally emitted (e.g. ARM add-with-
saturation).

~~~
Ygg2
Yeah, but assembly generally isn't portable (x86 assembly is different than
ARM assembly, etc.), that's what makes it biggest pain IIRC.

Asm.js on the other hand, is portable and just that makes it way better than
any regular assembly. Also it seems better looking than regular assembly (no
registers as such, no jumps, etc.).

It's a huge step back compared to plain JS, but it's not that impossible to
write in.

------
cnaut
Makes me think of this video "The Life and Death of Javascript " which brings
what the future could be like with asm.js:
[https://www.destroyallsoftware.com/talks/the-birth-and-
death...](https://www.destroyallsoftware.com/talks/the-birth-and-death-of-
javascript)

------
Sir_Cmpwn
I'm looking forward to Unity in the browser. The web player has never worked
on Linux.

Unfortunately, the first demo terminates my browser with a segfault.

Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0

~~~
nly
Segfaulted for me as well. FF v29.0.1, Arch Linux x86-64, kernel v3.14.3,
Intel HD4600 under Mesa/Intel DRI v10.1.3. The WebGL test link posted by
azakai does exactly the same thing though.

Discussion:
[https://bbs.archlinux.org/viewtopic.php?id=181408](https://bbs.archlinux.org/viewtopic.php?id=181408)

Worked really smoothly on Windows.

~~~
cpeterso
Does your crash show up in Firefox's about:crashes page? The crash report
might show whether it odds the same missing GL symbol the Arch Linux
discusses.

~~~
nly
about:crashes doesn't exist, but yes

------
ecthiender
The Dead Trigger 2[1] game runs amazingly smooth on FF 29.0, Debian, Kernel
3.2 and is amazing to play.

I have been playing for quite sometime now, but the only problem is I can't
find how to change the guns. There is no menu options or anything.

[1] [http://beta.unity3d.com/jonas/DT2/](http://beta.unity3d.com/jonas/DT2/)

~~~
azakai
Tab changes the guns. Also 1,2,3 do weapon-related effects (one of them is a
grenade, I think).

~~~
ecthiender
Yeah. Found it. 3 throws grenade. Tab - next weapon, q - previous weapon.

Played it for an hour or so.

------
CmonDev
I hope one day it will not be possible to run manually-written JS in browser.
You would need to use a safer language that compiles into an asm.js module.

