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

Approaching WebAssembly

Approaching WebAssembly

Slides from my WebAssembly talk at WeRise.tech

Dan Callahan

June 24, 2017
Tweet

More Decks by Dan Callahan

Other Decks in Technology

Transcript

  1. Plugins were dying, but no replacement. JavaScript is hostile to

    optimizations. Can’t re-use existing code on the Web. Why do we need WebAssembly?
  2. Be as safe and universal as JavaScript Run as quickly

    as native code Provide consistent, predictable performance Allow code re-use between Web and native Design goals for WebAssembly
  3. Games (e.g., Unreal, Unity) Multimedia (e.g., AV1, FLIF, BPG) Performance

    (e.g., KeeWeb, Mega) Libraries (e.g., OpenCV, Box2D, LibSass) 64-bit Math (e.g., MAME, SHA512) Where does WebAssembly make sense?
  4. A compiler target for the Web 1. Low-level, binary format

    for programs 2. Open standard with cross-browser support 3. Direct successor of asm.js 4. General purpose virtual architecture What is WebAssembly, again?
  5. Doesn’t replace JavaScript, but does expand the Web. Enables new,

    hybrid (WASM + JS) designs. For compilers, Web is just another platform. WebAssembly is here. It works. Why is WebAssembly interesting?
  6. Is JavaScript dead or dying? JavaScript is alive. Its client-side

    monopoly is dead. Each complements the other:
 - High-level vs. Low-level
 - Text vs. Binary
  7. Is JavaScript dead or dying? JavaScript is alive. Its client-side

    monopoly is dead. Each complements the other:
 - High-level vs. Low-level
 - Text vs. Binary WASM makes new things possible.
  8. What about older browsers? Use asm.js as a fallback. Emscripten

    C/C++ 㱺 asm.js 㱺 wasm 㱺 asm.js 㱺
  9. What about older browsers? Use asm.js as a fallback. Emscripten

    Binaryen C/C++ 㱺 asm.js 㱺 wasm 㱺 asm.js 㱺
  10. Can I compile JS to WASM? Don’t do that. You’d

    have to ship your own JS runtime.
  11. Can I compile JS to WASM? Don’t do that. You’d

    have to ship your own JS runtime. The one included with your browser is great.
  12. What about type errors? Like in JS, the browser coerces

    types. There are well defined rules for this.
  13. What about type errors? Like in JS, the browser coerces

    types. There are well defined rules for this. No different from Math.sqrt(“hello world”);