News for hackers. Stuff that matters.
Re:The Elusive Universal Web Bytecode by flohofwoe on Thursday March 26, 2015 @09:57AM (#9269610)
The author is Alon Zakai, creator of emscripten, and the article is quite old (2013) when there was a somewhat heated debate whether a byte code format would be better for the web instead of Javascript, with the byte code fans having fairly theoretical reasons (basically: 'because it is the right way to do it and Javascript sucks anyway'), instead Alon went ahead and demonstrated that in reality the more pragmatic solution to compile to JS has no disadvantages compared to byte code, and you don't need to add a whole new language engine to browsers (like Google PNaCl does), but (in the case of asm.js) only fairly minor modifications to existing JS engines, and you keep full compatibility (but lower performance) with old JS engines.

Interestingly, emscripten now also supports an interpreted byte code mode (called emterpreter), which stores code in a byte code format, and runs this inside an JS interpreter(!). The reason for this was quicker startup time for large scripts, but (my own speculation!) it might also be a path to a future byte code distribution format if there are indeed any other practical advantages.

Another interesting point is that Safari actually has now an LLVM based compilation layer in their Javascript engine, so it's coming together from both sides with LLVM being the glue (emscripten's front end is also LLVM).

Re:The Elusive Universal Web Bytecode by falcolas on Thursday March 26, 2015 @01:12PM (#9271285)
> more pragmatic solution to compile to JS has no disadvantages compared to byte code

The disadvantage is that compilation takes a not-insignificant amount of time, particularly if you want to go from running AST on a VM to running platform native code. It takes even longer if you're on an underpowered device which could take the most advantage of a simple IR bytecode -> native bytecode compilation.

This is evidenced in the 50% numbers from the OP's article.