Article summary
Here is a summary of the key points from the blog post:
-
Garbage collection is a way for programming languages to automatically reclaim memory that is no longer being used by a program. Many modern languages like Java and Kotlin use garbage collection.
-
WebAssembly (Wasm) is a new runtime that allows programs written in various languages to be run in web browsers. However, traditionally each language needed to bundle its own garbage collector when compiled to Wasm, which was inefficient.
-
WasmGC is a new proposal that allows programming languages compiled to Wasm to integrate with the browser's built-in garbage collector. This eliminates the need to bundle a redundant collector.
-
WasmGC enables smaller file sizes for Wasm programs. A Java benchmark was 6x smaller than equivalent C and Rust versions since it didn't need to bundle a memory manager.
-
Languages like Kotlin and Dart/Flutter are now being ported to leverage WasmGC. This will enable new use cases like running Flutter apps on the web.
-
WasmGC is still in early stages but shows promise for allowing more languages to efficiently target Wasm and the web.
Comment summary
Here is a summary of the key points from the Hacker News discussion about running GC languages like Java and Kotlin in the browser with WebAssembly and WasmGC:
Positive Sentiment
-
Exciting to be able to run languages like Java, Kotlin, and Dart in the browser with WebAssembly. Opens up new possibilities for web development beyond just JavaScript.
-
With WebAssembly and WasmGC, more developers can bring their existing experience with GC languages like Java to web development. Lower barrier to entry compared to languages like C/C++ or Rust.
-
Having WebAssembly and WasmGC as standards rather than proprietary browser plugins is a big improvement. More secure and cross-browser compatible.
Negative Sentiment
-
Concerns that supporting many different languages' needs with a single GC implementation will be difficult or limiting. Some languages may need special handling like interior pointers or pinning.
-
Browser JavaScript APIs are increasingly moving away from documents towards applications. Some feel the web platform should remain focused on documents.
-
Safari still lags behind other browsers in WebAssembly support. Lack of iOS support could limit adoption.
Recommended Actions
-
Prioritize working on support for interior pointers, pinning, and other special GC needs of different languages.
-
Carefully design browser APIs to maintain a balance between documents and applications.
-
Engage with Apple/Safari developers to improve WebAssembly support and achieve cross-browser compatibility.
Interesting Links
- https://github.com/dart-lang/web/blob/main/test/smoke_test.dart
- https://medium.com/@addyosmani/photoshop-is-now-on-the-web-3fbff88931e7
- https://web.dev/articles/ps-on-the-web
- https://linuxontheweb.github.io/
- https://davexunit.itch.io/strigoform
- https://spritely.institute/hoot/
I lead the Chrome Developer Relations team at Google.
We want people to have the best experience possible on the web without having to install a native app or produce content in a walled garden.
Our team tries to make it easier for developers to build on the web by supporting every Chrome release, creating great content to support developers on web.dev, contributing to MDN, helping to improve browser compatibility, and some of the best developer tools like Lighthouse, Workbox, Squoosh to name just a few.