by atonse · 9y ago · 0 comments
What many people think it is: I can compile my JS frameworks as assembly and ship binaries to the browser, that'll run near-native and be more compact.
What WebAssembly actually is: a way to compile libraries from other languages in a manner that you can run them in a JS runtime, but with no access to the DOM, etc. (Think of things like shipping a JS based OCR library or a JS based audio-engine that runs at near-native speeds)
For as long as I'm in IT, there has always been the story of an upcoming holy grail of technology that'll change everything aka the silver bullet. Reading through this thread, that role seems currently occupied by WASM, with wild projections of all kind of perceived problems of frontend development and beyond onto WASM.
The reality is I have yet to see a single app making use of WASM on the web. And even when, if, there eventually is a WASM app, it won't be able to do anything that other (native) development environments haven't been able to do for ages. I'm not sure the world needs a new bytecode format, when only the ARM and x86_64 ISAs are still around. OTOH, what's new with WASM is that the browser and the internet acts as a gatekeeper for starting apps on your device, which I'm not sure will be met with enthusiasm by users. Furthermore, since WASM lacks APIs for even the most basic things, it would take ages to establish a platform, with all the fragmentation this entails.
IMHO a spectacular example is stockfish on lichess.org. On some browsers, like Chrome and Firefox IIRC, it is still slower than PNACL or asm.js, but on Microsoft Edge it is the fastest solution and it's what is currently used for this browser. It should be the fastest solution everywhere once multithreading is added.
The developer of lichess stated that is was fairly trivial to port stockfish to webassembly and compile it for lichess. When I saw it running, I was impressed (and still am).
There will be access to the DOM, but even without it, WebAssembly is still useful.
You compile libraries that are performance sensitive, you use them from you JS code, and voilà, you have the best of both words : the flexibility and DOM access with JS, and the speed of compiled code with wasm.
That's just not how it'll work.