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

WebAssembly - post MVP features and goals

WebAssembly - post MVP features and goals

Slides for a talk presented at ParisJS meetup, link to the talk: https://www.youtube.com/watch?v=nOG0lHpRxQ8

Topics:
- WebAssembly working group
- Threads
- WebAssembly runtime performance
- WebAssembly load perfomrnace
- High-level language features

Elia Maino

June 26, 2019
Tweet

More Decks by Elia Maino

Other Decks in Technology

Transcript

  1. The mission of the WebAssembly Working Group is to standardize

    a size- and load-time-efficient format and execution environment, allowing compilation to the web with consistent behavior across a variety of implementations.
  2. Features proposals WebAssembly W3C process https://github.com/WebAssembly/meetings/blob/master/process/phases.md “ A feature is

    a substantial change to WebAssembly, such that it for example requires additional opcodes, types, tests, or module sections. ”
  3. Performance MULTI THREADING Status: Proposed spec text available Experimental feature

    https://developers.google.com/web/updates/2018/10/wasm-threads Security issues with SharedArrayBuffer https://github.com/emscripten-core/emscripten/wiki/Pthreads-with-WebAssembly https://blog.mozilla.org/security/2018/01/03/mitigations-landing-new-class-timing- attack/
  4. Please access from desktop Chrome, Firefox, Safari or Chromium based

    browsers since this project uses SharedArrayBuffer and Atomics. On Firefox or Safari, feature flags (javascript.options.shared_memory for Firefox) must be enabled for now.
  5. Performance SIMD Single Instruction Multiple Data: process things in parallel

    https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md Status: Feature proposal
  6. Performance 64-bit addressing Remove the artificial limitation of addressable space

    From WebAssembly https://github.com/WebAssembly/design/blob/master/FutureFeatures.md#linear- memory-bigger-than-4-gib Status: Pre-proposal
  7. Language Features GARBAGE COLLECTOR Add an integration with the browser

    garbage collector JS needs a way to describe an object fixed structure Typed objects: https://github.com/tschneidereit/proposal-typed-objects WebAssembly GC: https://github.com/WebAssembly/gc Status: Feature proposal
  8. Language Features EXCEPTION HANDLING Proper support for languages exceptions By

    default disabled in WebAssembly when compiling (there’s an heavy polyfill) Hard to handle the case when WASM calls some JS code which throws an exception :/
  9. Language Features EXCEPTION HANDLING Proper support for languages exceptions Status:

    Feature proposal https://github.com/WebAssembly/exception-handling
  10. Language Features DEBUGGING DevTools for JS debugging are great Support

    a similar level of debugging for WebAssembly https://github.com/WebAssembly/debugging
  11. Loadtime STREAMING COMPILATION Compile a WebAssembly file while it’s still

    being downloaded Status: Shipped (depends on the browser)
  12. Loadtime STREAMING COMPILATION Status: Shipped (depends on the browser) https://v8.dev/blog/v8-release-65

    Shipped https://hacks.mozilla.org/2018/01/making-webassembly-even-faster-firefoxs-new- streaming-and-tiering-compiler/ Shipped
  13. Loadtime TIERED COMPILATION Having more than one compiler in action

    browser basic compiler optimizing compiler
  14. Loadtime TIERED COMPILATION Having more than one compiler in action

    browser basic compiler optimizing compiler ✨
  15. Loadtime TIERED COMPILATION Having more than one compiler in action

    browser optimizing compiler ✨ basic compiler
  16. Loadtime TIERED COMPILATION Status: Shipped (depends on the browser) https://v8.dev/blog/liftoff

    https://hacks.mozilla.org/2018/01/making-webassembly-even-faster-firefoxs-new- streaming-and-tiering-compiler/ https://github.com/CraneStation/cranelift https://webkit.org/blog/7691/webassembly/ (OMG! BBQ!)
  17. Loadtime Implicit HTTP caching Take advantage of WebAssembly predictable compilation

    output Using the already compiled machine code Instead of the .wasm file Status: Work in progress
  18. Loadtime Implicit HTTP caching Status: Work in progress https://v8.dev/blog/wasm-code-caching Work

    in progress https://bugzilla.mozilla.org/show_bug.cgi?id=1487113 Shipped
  19. Modules Calls between JS and WASM Calls between the two

    environments where working in the MVP But weren’t optimized to be fast https://hacks.mozilla.org/2018/10/calls-between-javascript-and-webassembly-are-finally-fast- %f0%9f%8e%89/ Status: Shipped (in )
  20. Modules Data exchange between JS and WASM WASM only understands

    numbers, add a way to pass/ reference objects too https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/ Overview.md Status: Implementation Phase
  21. Modules ES Modules integration Load WebAssembly from a JavaScript import

    statement, or a <script type=module> tag https://github.com/WebAssembly/esm-integration/tree/master/proposals/esm- integration Status: Feature proposal