Young Reacts #62 – WebAssembly Summit

I attended the first-ever WebAssembly Summit this week. It had a very distinct feel to it than other more established conferences I have been to. It had a single track and happened on a single day. A lot of contributors/early adopters were in the room, and the speakers geared toward them. I went there to find compelling use cases that could be applied to my day-to-day work, but I wasn’t able to achieve that, which tells me the technology is still in the early adopter phase.

You can find my (messy) note here if you are interested in learning more.

Speakers and organizers


People ❤

How to Give a Killer Presentation

In April, I am giving a talk in front of the largest audience in my experiences so far. It is honestly terrifying, so I will give it my 100%. This guide from Chris Anderson, the TED organizer, says a compelling narrative is the most important.

Software Engineering 🌐

Fire Mario, not Fire Flowers

When we engineers think about solving a problem, our goal should be to make our users awesome (Fire Mario) rather than to create an excellent tool (Fire Flower).

WebAssembly music

The coolest presentation I saw at the WebAssembly Summit. The link will play the synthesized sound purely from code.

GraphQL Server Specification: Mutations

The most essential trait of GraphQL API is backward compatibility. The relay spec is an easy way to future proof the compatibility.

Business 💸

Front Series C Deck

Mathilde Collin has published the deck that raised $59 million for Front, a shared inbox company. Here are Series A deck and Series B deck as well.

HQ Trivia shuts down after acquisition falls through

An online trivia service that was so hot just a couple years ago shut down. I still remember how envious my team was of the service when I was at an online community startup. Consumer-facing services are a tough business.

WebAssembly Summit 2020 Recap

Organizers and Speakers 👏

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
    • Vulnerable 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):

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

What do the above numbers mean?

  1. Javascript has an unwilling monopoly.
  2. Performance is not as large of a concern as you would respect.
  3. 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

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

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

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:

  1. Javascript to WebAssembly
  2. Threaded build
  3. 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