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

Gophers Darmstadt: Running Go in your browser using Wasm

Gophers Darmstadt: Running Go in your browser using Wasm

WebAssembly is a new way to write high performance applications and modern games for the browser. It can run applications in a near-native way and first demos show e.g. Epic's Unreal Engine running in a browser. WebAssembly is already a compile target for lots of languages most prominently Rust and is supported by all modern browsers. The newest release of Go also adds experimental support for WebAssembly. This talk will present the current possibilities and limitations when programming for WebAssembly in Go and showcase the new "syscall/js" API to call into JavaScript.

Markus Zimmermann

August 28, 2018
Tweet

More Decks by Markus Zimmermann

Other Decks in Programming

Transcript

  1. Running Go in your Browser using Wasm AUG 28 2018

    Markus Zimmermann cosee @markus_zm
  2. Any app that can be written in JavaScript, will eventually

    be written in JavaScript Jeff Atwood
  3. GopherJS • Written by Richard Musiol (@neelance) • Compiles Go

    to JavaScript • API to interact with DOM included
  4. Wasm Goals • Portable binary format • Integrated with existing

    web platform • Near-Native speed in Browser • Secure execution environment
  5. syscall/js Transformations from JS Value to Go type: Bool(), Float(),

    Int(), String() Arrays TypedArray, Index(), SetIndex() JS util InstanceOf(), Length(), Type()
  6. Current Limitations • No native DOM APIs (yet) • No

    multithreading (yet) • Large binary file sizes • Performance not yet where it should be
  7. Package-Level Caching • https://github.com/dave/jsgo • Splits the JS up by

    Go package • Stores the JS in a CDN • https://github.com/dave/wasmgo