Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WebAssembly for the masses

WebAssembly for the masses

Providing a consistent and reliable performance is a nightmare in JavaScript. Different engines, different optimizations, and unmaintainable code. If the above sounds are familiar, then WebAssembly is for you. Let us embrace the near-native performance consistently.

This is a complete talk on WebAssembly.

What is WebAssembly and what does it provide?
Why you need WebAssembly?
Which language supports it?
How to use it with demos?
Where it will be in the future?

Sendil Kumar N

June 24, 2019
Tweet

More Decks by Sendil Kumar N

Other Decks in Technology

Transcript

  1. Computer / Machine / Server Send me 0s & 1s

    010101010101010101010101010101010 @sendilkumarn
  2. Computer / Machine / Server Send me 0s & 1s

    010101010101010101010101010101010 @sendilkumarn
  3. Computer / Machine / Server A S S E M

    B L E R mov eax, 14 mov ebx, 10 add eax, ebx 010101010101010101010101010101010 @sendilkumarn
  4. Machine A S S E M B L E R

    mov eax, 14 mov ebx, 10 …. 010101010101010101010 C O M P I L E R Int sum = a + b; @sendilkumarn
  5. Machine A S S E M B L E R

    mov eax, 14 mov ebx, 10 …. 010101010101010101010 C O M P I L E R Int sum = a + b; Machine Machine Machine Machine Machine @sendilkumarn
  6. Machine 010101010101010101010 Machine Machine Machine Machine Machine Browsers JS Engine

    Layout Engine And many more… let’s simplify things... @sendilkumarn
  7. Machine 010101010101010101010 Machine Machine Machine Machine Machine Browsers JS Engine

    Layout Engine HTML / CSS / JavaScript JavaScript @sendilkumarn
  8. Machine 010101010101010101010 Machine Machine Machine Machine Machine Browsers JS Engine

    HTML / CSS / JavaScript Bytecode (or) WASM @sendilkumarn
  9. What is a WebAssembly Module? • The Wasm stack machine

    is designed to be encoded in ◦ a size- and ◦ load-time-efficient binary format. • WebAssembly aims to execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms. @sendilkumarn
  10. Browsers Your favorite language C O M P I L

    E R Bytecode (or) WASM JS Engine It works... @sendilkumarn
  11. ⚡ Fast ⚡ ~30% faster than JavaScript Not always the

    faster variant. Limit the boundary crossing Near-native performance @sendilkumarn
  12. JavaScript execution PARSE AST INTERPRET Byte Code 1010101 0101010 1010101

    Profiler COMPILE 1010101 0101010 101 EXECUTE OPTIMISE 1010101 010101 GC EXECUTE EXECUTE @sendilkumarn
  13. 1010101 0101010 1010101 DECODE 1010101 0101010 1010101 COMPILE 1010101 0101010

    1010101 EXECUTE WebAssembly execution @sendilkumarn
  14. C / C++ Best performance... It is C / C++

    More verbose Emscripten - father of toolchain @sendilkumarn
  15. Rust Best tool chain available Performance needs to be tuned

    Integrated with the language @sendilkumarn
  16. Reference type proposal JS WASM Send me only numbers JS

    WASM Send me JS Objects @sendilkumarn