19 points · by elamje · 7y ago · 12 comments
Do you think WebAssembly is the next major internet development disruptor? Why or why not?
Do you personally see asymmetric gains for investing in learning it while its young?
My guess is that there will be a 5-year period of explosion in a) compilers for existing languages; b) frameworks for working with the DOM and other web APIs in said languages; and c) a few new languages built on top of it. Then there will be a few more years of transition where the winners and losers among all these new tools gradually sort out.
And then we’ll all go back to developing in higher level languages and compiling down - you’ll just have more options besides JavaScript, typescript, and coffeescript, basically. A few jobs will remain that involve tuning compilation.
As in, unless you're interested in working on compilers or web applications that need low-level optimizations on the client-side despite existing WebAssembly compilers, you won't need to "learn" WebAssembly.
That said, here are a few examples of where it shines (warning: shameless plugs incoming):
- In data analysis apps, you can replace slow JavaScript calculations with WebAssembly and see significant speedups--I wrote this case study on my experience with that: https://www.smashingmagazine.com/2019/04/webassembly-speed-w...
- It's super helpful in porting games from languages like C/C++ to the web without having to rewrite the game from scratch. Here's a post I wrote about how to port a game like Asteroids to the web: https://medium.com/@robaboukhalil/porting-games-to-the-web-w...
- WebAssembly is really good for building playgrounds out of command line tools. Here's how I built one for the jq CLI: https://opensource.com/article/19/4/command-line-playgrounds..., the benefit being more secure than hosting it on the backend + much faster runtime
- I'm also excited to see how WebAssembly will impact work outside the browser: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webas..., especially with Function-as-a-service offerings that support Wasm like Cloudflare/Fastly workers, where the benefit is that I can write my function in any language + the time to initialize the function could be much faster
Another shameless plug: if you want a practical intro to WebAssembly, I self-published a book about it recently: http://levelupwasm.com/!
It's like a decent technological investment, though, one that could support a long-term career if you're interested in compilers or language tools. The trend long-term is away from Javascript as the sole language of the web, and WebAssembly is also finding its way into other platforms (eg. EOS) in the crypto & SaaS spaces.
WebAssembly looks like it'll be a major thing, but from the Go side it's still not really ready for production usage:
1. Generated binaries (by mainline Go) are still too large.
There's no good dead code elimination (my wording, it's actually a bit more than that) in generated Wasm, so the binaries are still MB instead of kB. :/
eg "Hello world" in Go is about 2MB, as it embeds pretty much the entire Go runtime instead of stripping it down to just the println() equivalent code.
These large binaries do compress ok (eg 2MB -> to 500kB), but still, that's pretty big.
2. There is an alternative Go compiler (TinyGo: http://tinygo.org) that generates much smaller binaries (eg 2kB), but it doesn't yet support all of the Go spec. When it's coverage is wide enough to generate Real World useful webasssembly, that should see a large increase in Gophers creating Wasm things. :)
3. Wasm doesn't yet have a good debugging story. eg no support yet for being able to breakpoint a wasm binary, step through it in an IDE, etc.
There's an official "WebAssembly Debugging" Subgroup putting time into adding the needed support to the spec:
https://github.com/WebAssembly/debugging
Yury Delendik seems to be the main person doing the work:
https://yurydelendik.github.io/webassembly-dwarf/
--
If there are Go people around interested in WebAssembly, the #webassembly and #tinygo channels on the Go Slack are fairly active, with lots of development co-ordinated there. :)
--
The WebAssembly page on the Go wiki has useful info too: :)
If you start with some Google Foo, you should be able to get your feet wet.
Our compiler is ready to target WebAssembly, but we can't run anything useful on it without those two.