
Website: WebAssembly Summit
Date: Feb 10, 2020
Recording: https://www.youtube.com/watch?v=WZp0sPDvWfw
The event was the first WebAssembly conference. It had a single track and happened on a single day. A lot of contributors/early adopters were in the room and the topics were geared toward them. I went there to find interesting use cases that could be applied to my day-to-day work but I wasn’t able to achieve that.
Here are my notes from the conference. I am no expert with WebAssembly so my notes may be incorrect:
Opening Keynote: WebAssembly: Building a new kind of ecosystem – Lin Clark
- WebAssembly on Web is portable and secure.
- WebAssembly on Server may lose security if we are not careful.
- Currently in Node.js ecosystem, there is no sandbox to secure the system from 3rd party codes
- Malicious code
- Example: electron-native-notifier. A Bait and Switch scheme to steal bitcoins
- Memory access
- The number of malicious code has doubled from 2017 to 2019
- Example: electron-native-notifier. A Bait and Switch scheme to steal bitcoins
- Vulnerable code
- Example: Zip Slip https://snyk.io/research/zip-slip-vulnerability
- Malicious code
- Spinning up a new process as OS does for a library is too expensive
- Memory issue
- IPC is hard to deal with
- Solution (WebAssembly Nanoprocesses):
- Sandbox
- Memory model (memory isolation)
- Interface types: copy from an isolated memory to another memory to pass the data
- WebAssembly System Interface (capability based security)
- The missing link
- How to pass the said capability to the dependencies
- Nanoprocess isn’t a standard yet. just a convention. ByteCode Alliance works to provide a secure foundation.
References
Shipping Tiny WebAssembly Builds – Alon Zakai
WebAssembly is usually smaller than Javascript because
- dead code elimination
- binary format
Has a risk tho:
- big runtime lib requirements
Tip 1: Compression: GZip or Brotli
Tip 2: wasm-opt will generate a smaller wasm from a wasm via:
- dead code elimination
- constant propagation
- inlining
- since wasm-opt is running at Link Time Optimization
- wasm-opt will be run by some tool sets out of the box
Tip 3: size profiling
- Bloaty
- Twiggy
- wasm-opt’s —func-metrics
There is a tradeoff between writing a idiomatic code vs. the smaller binary output
C/C++ Tip (a lot of specific tips):
- EM_JS to use WebAPI
Rust Tip:
Go Tip:
- TinyGo vs. the regular runtime size differences
References
Why the #wasmsummit Website isn’t written in Wasm, and what that means for the future of Wasm – Ashley Williams
WebAssembly shouldn’t replace Javascript
How are values prioritized for WebAssembly? The community does not have an explicitly shared vision. We should make it easier for people to use WebAssembly.
Empowering people!
What does WebAssembly want?
- Marketing does not speak the language of the people it wants to reach
Rust, C++, Javascript, Academia, New Developers all get together
What do people want from WebAssembly?
- multilanguage support
- Why? JS doesn’t meet my need
- Why? performance inconsistencies / don’t understand/like it
- Why? JS doesn’t meet my need
What do the above numbers mean?
- Javascript has an unwilling monopoly.
- Performance is not as large of a concern as you would respect.
- A lot of people haven’t tried WASM yet.
History of Programming Language Development
- 1995 → High-level abstractions (Ruby, Javascript, Java)
- 2010 → Low-level languages (Go, Rust, WASM)
The demand for speed of computation on Web is growing since Web is the most powerful distribution channel.
Excel and Flash were hugely empowering technologies. WebAssembly should strive to be the same.
References
- https://words.steveklabnik.com/fire-mario-not-fire-flowers
- https://www.jwz.org/doc/worse-is-better.html
- https://github.com/rustwasm/wasm-pack
JavaScriptCore’s new WebAssembly interpreter – Tadeu Zagallo
I didn’t take much note here since this article (https://webkit.org/blog/9329/) can represent the talk very well.
WebAssembly Music – Peter Salomonsen
A talk on generating midi music with WebAssembly implementation. Javascript to write songs and WebAssembly to generate sound. He was able to create an executable out of the Javascript to play the song via terminal.
References
WebAssembly and Internet of Things – Jonathan Beri
What is IoT?
- Embedded systems
- Constrained
- Limited processing power and battery
- Limited connectivity
- Constrained
In 2017, a runtime for embedded systems did not exist.
A unikernel is a specialized OS for a single application.
Unikraft works to enable building unikernels with ease. Unikraft
WebAssembly on Arduino is now possible thanks to WAMR and WASM3
References
- https://github.com/emscripten-core/emscripten/issues/6147
- https://github.com/wasm3/wasm3
- https://github.com/bytecodealliance/wasm-micro-runtime
Building a Containerless Future with WebAssembly – Kevin Hoffman
Low-level runtimes: https://github.com/appcypher/awesome-wasm-runtimes
Mid-level runtimes: waPC https://medium.com/@KevinHoffman/introducing-wapc-dc9d8b0c2223 & wasCAP https://docs.rs/wascap/0.3.0/wascap/
High-level runtimes: waSCC https://wascc.dev/
Since webassembly is without container, its code can be updated on the fly without rebooting (dynamically bound).
My Q: Why waSCC is needed when you have the sandbox?
WebAssembly as a <video> polyfill – Brion Vibber
Limitations to wikipedia’s tech stack due to its philosophy. It could only use open/public licenses
Over time, they optimized the polyfill with:
- Javascript to WebAssembly
- Threaded build
- SIMD
References
Closing Keynote: WebAssembly: Expanding the PIE – Ben Smith
This talk felt like a recap of the community for the last 4-5 years. Incrementalism in WebAssembly community enable moving forward at a steady pace
Sep 2015
- ml-proto (ocaml based) ⇒ WebAssembly reference interpreter
- v8-native-prototype (binary format) ⇒ becomes WebAssembly binary format
- a two weeks bet to translate ml-proto to v8-native-prototype: sexpr-wasm ⇒ sexpr-wasm-prototype ⇒ wabt
A modest goal at the time: C++ compile to WebAssembly. WA and JS interop.
APIE has been expanding since its inception:
- Ability
- Producer
- Interop
- Embedder
Sep 2017
Notable proposals: Garbage Collection, Host bindings
Jun 2018
Notable proposals: Garbage Collection, Reference Types (later became Interface Types), Wasm C API
Aug 2019
Notable proposals: Typed Function References, Type Imports, WASI, Interface Types
Feb 2020,
Notable proposals: Reference Types (Phase 4), GC, Wasm C API, WASI, Interface Types
1 Comment