188 points · by leo2urlevan · 11y ago · 86 comments
While Chrome's results have been impressive, in my experience Firefox does much better for Asm.js code - at least for the games I've been playing. So what benchmarks have you seen?
Also, Google not getting involved in asm.js to make it better, but developing and promoting PNaCL and Dart, well that to me just smells like Microsoft's lock-in tactics with IExplorer in the nineties.
However I bet the Android team only added the NDK forced by upper management, given how little care they give to it.
Isn't that something that benefits us all? I'm happy they're trying, at least.
Related, and you've sort of mentioned this: having your browser be able to validate asm.js is useful for web developers, because then they know if their code is broken (and so will run slower).
I absolutely agree there are advantages to taking the asm.js -> LLVM bytecode shortcut (cue every single benchmark showing FF on top). But compiler warnings are not one of them.
EDIT: To clarify: my point is that this is not classical compilation, but rather "interpretation of the generated code". Nobody writes asm.js by hand, no matter how it is executed. If there are errors in there, there is something seriously wrong with the tooling, and when the errors show up will be the least of your worries. Comparable to errors in a .jar file or a .pyc---this is just not something we need to be generally concerned with.
EDIT2: I don't mind the downvotes but if I'm wrong, please explain so at least I understand. Otherwise I won't learn.
Seems to me THAT is the way to go, but this is not my area of expertise.
Looks to be the year of WebGL + asm.js across all browsers sometime this year. If so next year could be big for WebGL and web gaming again. And one day it could also make an impact on mobile but that seems to be moving ahead with things like Apple Metal and Khronos Vulkan (OpenGL successor - https://www.khronos.org/vulkan).
I understand why other browsers don't implement the Pepper API, because it's highly Chrome-specific; however, I'd like to see other browsers implementing the native-code sandbox, at least.
Secondly, it's based on a self-contained open source spec that constitutes a logical subset of another widely-supported open spec (ECMAScript) - no convoluted, versioned APIs coordinated by large, possibly competing and mutually incompatible engineering efforts. The asm.js spec is actually so simple it fits on a single web page: http://asmjs.org/spec/latest/
Yet it pretty much manages to achieve all that NaCl does by being also forwards-compatible with all the DOM-based extensions like HTML5 without needing any additional APIs (many asm.js demos for example bind to WebGL - this does not require any additional "asm.js API", as the browser's existing WebGL implementation suffices)
> Secondly, it's based on a self-contained open source spec that constitutes a logical subset of another widely-supported open spec (ECMAScript) - no convoluted
I'm going to have to stop right there. asm.js is a lot of things, but "not convoluted" is certainly not one of them. asm.js involves compiling native code to JavaScript in the hopes that browsers will translate it back to some semblance of the same native code.
Chrome already provides some speedup on asm.js code https://hacks.mozilla.org/2015/03/asm-speedups-everywhere/
I can AOT compile a complete binary, and can run on (just about) any target.
If I want to implement asm.js, I have to implement a full JavaScript JIT (if I want decent performance). This is Hard. I can't AOT compile, by the nature of JavaScript.
So, no, there is a difference. One of these technologies brings the entire bloated browser technology stack along with it, and one finally cleans up that bloat.
Also, both are based on single-vendor, single-implementation technology. NaCl used actual native code, so if you're not using x86-64 or ARM, too bad! And PNaCl uses LLVM, so there's only one implementation.
Compare this to asm.js. It's a strict subset of ECMAScript/JavaScript, which has several high-quality implementations, and is portable across platforms. It uses the existing standard web APIs, which also have several high-quality implementations.
asm.js is attractive because it is a small extension to the Web platform, so the overall additional complexity of an HTML/CSS/JS engine (which we are likely never going to be able to drop) doesn't go up much by implementing asm.js optimizations.
And on "emulating much better native platforms", well those native platforms are also trying (unsuccessfully) to emulate the web and the web is still winning.
Edit: to those downvoting me (classic), when I left this comment the parent was at -2 or -3 votes and at the bottom of the page.