Abhishek Yadav
4 Jan 2020
What languages can be compiled to WASM ?
C, C++, Rust, Javascript
What about Python/Ruby/Java ?
Not yet
Its planned, but needs a GC implementation, which is in progress
Will WASM replace (kill) Javascript ?
Can WASM programs access the DOM ?
No
No access to any web apis directly
Is it faster than Javascript ? How fast ?
It is faster
Its all going to run on the same browser engine, both JS and WASM. Well optimised JS can perform at par with WASM
Can I use it today ?
Yes
WASM support has been implemented by most major browsers including Edge (but not IE)
Works even on IOS Safari, Android Browser
WASM-MVP has been stable for a while
Who is using it ?
Some examples:
Can it run outside the browser ?
Yes, since recently
What are some other use cases ?
Anything CPU intensive -
https://webassembly.org/docs/use-cases/
Is it safe to run native code in the browser ?
Yes
Secure sandboxing has been one of the design principles for WASM
Memory management layer is designed from grounds up to support pointer based operations
More details in next session
Can we use multi-threading in WASM ?
Not yet
Pthread support work is in progress
What are the main constraints ?
(What's the catch)
Can we run a Python interpreter on web - as its written in C ?
Yes
It has been attempted using ASM.js
But its not very useful - because of the binary size.
Will be a great when Python program compiles directly to WASM
Does it make sense to compile JS to WASM ?
Yes, for very large JS projects - where the parse time is a problem, especially on weaker devices
Otherwise, once loaded (and JITed), JS is fast enough
Is it the same as asm.js ?
Very similar but not the same.
EmScripten is being reused
(More details in next session)
Will WASM replace (kill) Javascript ?
No
Not soon at least