6 ms·
It's the same interface for the developer, but instead of being run directly on the CPU, it's run in a JavaScript virtual machine that interprets it or eventual
by jackowayed 13y ago
It's the same interface for the developer, but instead of being run directly on the CPU, it's run in a JavaScript virtual machine that interprets it or eventually compiles it to some kind of native code. That's very hard to overcome from a performance standpoint.
- rdw 13y agoasm.js is translated into native code before it's run, which is exactly the same as PNaCL, which is delivered in a non-executable format that has to be translated to the native architecture before it's run. The two technologies are just different standards for the exact same underlying idea.
- capisce 13y agoExcept LLVM bitcode seems much more able to expose the cabilities of the underlying CPU compared to asm.js. I guess we'll just have to wait to see what the benchmarks say.
- cpeterso 13y agoPNaCL doesn't "run directly on the CPU" any more than asm.js. They are both intermediate formats that must be compiled locally.
- pcwalton 13y agoI don't know what the difference between running "directly on the CPU" and "compiling to some kind of native code" is. If you mean that the Web page delivers raw machine code to the browser, that describes NaCl, not PNaCl. Regardless, it is incorrect that asm.js is first interpreted before being compiled. asm.js is compiled ahead of time exactly as PNaCl is.
- justncase80 13y agoThis doesn't sound right. It's a subset of javascript, you are still shipping javascript to the browser... which is then parsed and then jitted in said browser. Which is an extra step above bitcode, where you just jit it as is. Albeit it's specifically crafted to be easier to optimize but it is still javascript that you are sending to the browser. I feel like someone is trying too hard to make javascript into something it isn't and shouldn't be. Javascript does it's thing pretty well, why is there no room for other tools in the toolbox?
- 0x0 13y agoI doubt parsing and validating ascii asm.js is much more work than parsing and validating binary llvm.
- alexchamberlain 13y agoI call Bullshit.
- pcwalton 13y agohttps://github.com/dherman/asm.js/tree/master/lib https://github.com/dherman/asm.js/tree/master/lib is about 1,500 lines of code. The contents of Bitcode/Reader/ in LLVM are about 3,000 lines of code alone, and that does not include the definition of LLVM data structures, the validator, etc.
- TazeTSchnitzel 13y agoNo it's not. asm.js, like PNaCl, uses ahead-of-time compilation.