DEV Community

Ben Halpern
Ben Halpern

Posted on

Explain the State of WebAssembly to Me

I'm not looking for an explanation of WebAssembly, but more the WebAssembly ecosystem. What kind of support structure is in place for the technology as of November 2019?

Top comments (18)

Collapse
 
andrewbrown profile image
Andrew Brown πŸ‡¨πŸ‡¦

Angular - When mommy packs you a Lunchable for lunch
React - When mommy packs you lunch but forgets the pudding
VueJS - When mommy packs you leftover pizza for lunch
Mithril - When mommy packs you multiple Nutrigen bars for lunch
Svelte - When mommy packs what she calls a "better lunch" but you don't eat it because you just want what you're used to eating.
WebAssembly - When mommy has you make and pack your own lunch

Collapse
 
axelledrouge profile image
AxelleDRouge

I knew there was a reason I loved React. And WebAssembly seems really interesting, I like cooking.

Collapse
 
mellen profile image
Matt Ellen

So you're saying VueJS is the best? Or you only use it on Wednesdays?

Collapse
 
nickytonline profile image
Nick Taylor

I haven't followed it closely and it's on my TODO to learn, but this interesting Tweet just popped into my timeline.

Collapse
 
rhymes profile image
rhymes

Wow!

Collapse
 
josiebigler profile image
Josie Bigler

This is on my todo list this weekend. Using WABT (github.com/WebAssembly/wabt) create a WebAssembly Binary for my Conway's Game of Life calculation, and see how much faster it can be in WASM vs plain Js.

More or less my plan is to create a WAT file (a textual representation of a WASM binary) use the WABT's wat2wasm tool to create the module, and then call that module in my current Game of Life implementation.

There are other ways to compile to WASM, but using WABT seemed the most friendly initially, because I don't know much about C, C++, or Rust.

Collapse
 
dilakv profile image
dilakv

Could you share your conclusions with us?

Collapse
 
josiebigler profile image
Josie Bigler

I was unable to effectively call web assembly to make my Conways Game of life faster. I got to the point where i could create a WASM binary and could call the binary in JS, but learning WAT to create the modules was a lot, especially to do anything meaningful.

I then looked into using other tools to compile WASM binaries, namely AssemblyScript. I had trouble creating the binaries because there is (or was) a bug preventing it from working on my version of windows. I never got around to setting everything up on my Linux machine to continue exploring WASM, because life got in the way.

I know there are some blog posts around that have recreated Conways Game of life in WASM. Still havent seen what the performance improvement would be.

Collapse
 
jrop profile image
Jonathan Apodaca

WebAssembly is an open-standard, stack-based VM that includes: a bytecode format, an S-expressions text-based format, among other things. One can implement a VM in whatever language they chose, and be running WASM modules in that language. It's one of the most portable executable bundle formats due to its adoption. Despite its name, it is not limited to running only on the web (Google "Mozilla WASI", for example).

This means that one can write code in whatever source-language, bundle it into a WASM module, and begin executing it in various environments.

It does have limitations: the largest one, for example, is that the spec does not include a garbage collector, so the best source-languages for WASM (right now) are Rust/C++.

I look forward to (soon) being able to write Rust that can be imported into NodeJS, Python, etc. What is not clear to me, however, is how to expose APIs that my WASM module will need to the underlying code, without manually injecting it.

Collapse
 
adrienpoly profile image
Adrien Poly

A very nice example is squoosh.app/
You compress images right in your browser. Image compression is a very intensive task. Here it is performed using web assembly modules so it is fast and doesn't slowdown your browser

Collapse
 
yaser profile image
Yaser Al-Najjar • Edited

Ever thought of the web browser as an operating system just like Windows / Linux?

That's what web assembly is about, so that now we can use languages like C or Rust.

Why:

FASTER PERFORMANCE.

Use Cases:

Heavy desktop apps or games

Collapse
 
dystroy profile image
Denys SΓ©guret • Edited

For me it's not really about performances.

Most of the slowness of in-browser apps isn't because of JavaScript but because of bad designs, of bad frameworks, of bugs like memory leaks, of developers badly understanding how a browser computes and renders things.

For me it's about correctness and code ergonomics.

That's why my next in-browser application will probably be in Rust/Wasm.

Collapse
 
yaser profile image
Yaser Al-Najjar

Hmmm, so you tell me that it is possible to create a performance-greedy game like GTA V in the browser?

Thread Thread
 
dystroy profile image
Denys SΓ©guret

This isn't the usual use case, so I wasn't really answering this problem.

For such a game, the problem is also less the language (but it matters, yes) than the underlying solution to render on screen. Even with webassembly you still have no direct access to low level primitives, best you can do is using webgl.

Thread Thread
 
yaser profile image
Yaser Al-Najjar • Edited

Well, I see it as the main problem webassembly is solving...

Since as you mentioned already, most apps are slow cuz of bad code.

But webassembly is here to let you write desktop-like performant apps/games.

Here are some discussions in this regard: github.com/WebAssembly/WASI/issues/53

Collapse
 
gochev profile image
Nayden Gochev

WebAssembly is promising defiantly for porting games to the web it is the way,
however will it kill JavaScript I doubt, everyone is talking because no one likes JavaScript and everyone hopes WebAssembly will replace it, so they can use the language they already know.

The current support looks like this:

few insights about above

  • Emscripten is mostly about converting existing C++ apps.
  • TeaVM is awesome and maybe most promising, they have their framework and it works teavm.org/live-examples/todomvc/#/ the size is small and it is a viable alternative even today, it is not only for porting existing apps. Poor documentation.
  • Blazor is a joke, it downloads 2.5mbs of file always, adds about 2 seconds for loading of each page even static and on top of that on the server side it keeps state for every connected client so scales so so badly. As everything Microsoft ever written: nice for a demo, but nothing more.

For me the most promising are TeaVM (Java, Kotlin) and GO as it has official support (even as beta)

More info about other languages:

stackoverflow.com/questions/435408...

Collapse
 
ratherbsurfing profile image
Chad Collins

Regarding WASM... At least ... In regard to the state of joining Facebook groups about Web Assembly boils down to people that deeply hate javascript so it pretty much blows any good learning experience you can get out of those groups on fb, and I joined them all, and it always devolved into WASM vs Javascript and how much many of the folks that actually talk in those groups have devout hatred toward the language Javascript. After 25 years coding the web, it was my first ever experience being called a "hack" was in a WASM group... TLDR; WASM is slowly moving forward and is being spear-headed mostly by elitists who say things like "This is how the web should work.. " more than once... Full Disclaimer, ive watched exactly 3 tutorials averaging 3 hours each, and have high hopes for compiled browser apps and this standard known as WASM.

Collapse
 
geeksesi profile image
Mohammad Javad Ghasemy • Edited

this video is good : [Rust - WebAssembly,](youtube.com/watch?v=CMB6AlE1QuI}