Compiling Scala js to WebAssembly
summary
Since Scala.js 1.17.0 (Sept 2024) a single build switch produces WebAssembly plus a small JS bridge while preserving Scala.js semantics (except @JSExport). The work adds ~10,000 lines for the WASM backend, redesigns the IR for lambdas to avoid expensive JS crossings, and proposes new WASM features (JS primitive builtins and custom descriptors). Benchmarks show ~30% faster than JS on average, about 2× slower than the JVM, and 10k LOC for the backend with most features working end-to-end.
AI-written summary · about
chapters (8)
- 0:00Scala.js architecture
- 2:28Moving to WebAssembly
- 5:13Performance benchmarks
- 7:37IR and type system
- 12:36JavaScript interoperability
- 19:12Boxing and performance
- 29:55Language limitations and fixes
- 37:00Async and future work
related talks
51mScala.js and WebAssembly, a tale of the dangers of the sea
17mImplementing and Evaluating a High-Level Language with WasmGC and the Wasm (…)
34mTHE FUTURE OF WEBASSEMBLY FOR SCALA
56mScala.js: Safety and Sanity in the Wild West of Web development
01h 22mCompiling Haskell to WebAssembly
35mJavaScript ∩ WebAssembly
22mThe state of WebAssembly
42mWebAssembly: A New Compilation Target for the Web
