Hacker News new | ask | show | jobs
by transfire 2950 days ago
I believe that's why Web Assembly (https://webassembly.org/) has been created. Eventually we will be able to use any language that can compile to Wasm.
1 comments

Right now we can use any language which can be compiled to JavaScript. What will change? Wasm is not faster than JS.
For one thing, web assembly's architecture more closely matches the traditional backends that language designers are familiar with. Compiling to code to a byte code is a pretty much solved problem, and we have compilers that do this. Finally, while web assembly may not be faster than JS (although that really remains to be seen), it is faster to load.
AFAIK, today compilers are producing both asm.js code and Webasm binary. Webasm is for tomorrow, asm.js is for actual use, because it's backward compatible with any JS enabled browser.

Webasm is not so compatible. I tried to run random demo and got error message: CompileError: wasm validation error: at offset 8: binary version 0xd does not match expected version 0x1. WTF?

I tested https://webassembly.org/demo/Tanks/ demo, and on my system (Firefox, Fedora Linux 26), asm.js version is a bit faster to load than Webasm version. (Turn off support for Webasm in about:config to test). Asm.js: 1.57s to load from cache, Wasm: 1.82s to load from cache.

So what will happen when webasm finally more closely match traditional backends?

Wait till you need to load a hundred binary dependencies and see if will load faster