A Look At WebAssembly

My talk for the DublinJS Meetup, June 2018 ⚡️

Description: In this talk I will be looking at WebAssembly and what it can do for you. I will speak about the strong and weakpoints of using it in your apps, along with some things to keep in mind performance wise. Lastly, I will show a few resources and tools which make using WebAssembly in your apps and learning more about it easier

Slides: Available on SlideShare

Takeaways

  1. WebAssembly is best used for speeding up a small, performance intensive part of your app
  2. You can write WebAssembly raw, but it is hard, and much better to use higher level languages.
  3. Rust, C and C++ have first class tickets in the WebAssembly world
  4. There is no garbage collector, JIT or intermediate representation, which is some of the reasons why it is so fast
  5. WebAssembly can give speeds of up to 80% of native performance
  6. It runs in a sandboxed environment, and memory addresses are remapped to a typed array which can also be accessed from the javascript side
  7. Currently, DOM maniputations (and calling other related functions) have a bit of overhead, so loads of small function calls will give a performance loss, it is best to do everything on one side, and only passing between Webassembly and Javascript when needed.
  8. There is only support for numeric types, and tools like wasm-bindgen can give extra types such as javascript objects.
  9. You should check out WebAssembly Studio!

Demo

I also gave a demo, of a small markov chains implementation using WebAssembly and Rust!

Demo Image

You can see the source code on GitHub

Adam Kelly

Student at Skerries Community College & Developer

Skerries, Dublin http://adamkelly.com