3 ms·
> It's not the first time someone's had environments (sans game) running, see for example Quake3 (http://media.tojicode.com/q3bsp/ http://media.tojicode.com/q3b
by pcwalton 14y ago
> It's not the first time someone's had environments (sans game) running, see for example Quake3 (http://media.tojicode.com/q3bsp/ http://media.tojicode.com/q3bsp/).
Quake 3 was released in 1999. Unreal Engine 3 is a current and top-of-the-line engine for AAA games.
> There was a time when Sun was marketing Java and pushing heavily on this idea that it would one day meet or beat C/C++ performance, but it never quite got there after 2 decades (yes, in some circumstances it comes close, in others, it fairs badly).
This is totally different. asm.js is just a backwards compatible encoding of a different, much lower-level language. In fact, that lower-level language is in direct correspondence with the intermediate representation of a production-quality C++ compiler (clang)!
Sun never tried something like asm.js for Java; rather they claimed that the full language would be as fast as C and C++.
> memory, SIMD, layout, threading
asm.js gives full control over memory and full control over layout, with the exception of stuff like mmap() and mprotect() and self-modifying code.
SIMD is something that RiverTrail/ParallelArray can do. It should be added to asm.js.
As for threading, I'm personally in favor of an extension to allow a typed array to be shared between workers, races and all, with some primitives to allow synchronization. Not everybody is OK with this, but I personally believe we aren't likely to get to native performance without it. (Again, this is just my personal opinion; many disagree on whether a racy typed array is necessary.)
- cromwellian 14y agoYou can polyfill SIMD, but you can't polyfill threads. Once you add shared memory between workers, you've effectively violated the premise that asm.js will run everywhere, even places that don't understand it. In that case, you've got a portable intermediate representation of opcodes in a bloated legacy format, that is now incompatible with legacy runtimes. Why use JS format then?
- pcwalton 14y agoApps could feature detect threading and fall back to single-threaded mode for compatibility with non-asm browsers if it's not supported. Regarding the claim that asm.js is "bloated": http://mozakai.blogspot.com/2011/11/code-size-when-compiling-to-javascript.html http://mozakai.blogspot.com/2011/11/code-size-when-compiling...
- BrendanEich 14y agoSIMD is coming to JS, it's as short a path as adding to Dart (and Dart is not going cross-browser, so...). Why JS format? Because another syntax that's both fast to lex+parse and not future-hostile (as JVML was) is a tall order and we'll get to it only when we really need it. Adding SIMD to JS does not require adding a whole new syntax! /be