Hacker News new | ask | show | jobs
by seanw444 726 days ago
Is Wasm performance that far off of native that the difference between bundled GC and native GC is noticeable?
3 comments

There are several problems with bringing your own GC. Some that come to mind:

* Significantly increased binary size

* No easy way to trace heap objects shared amongst many modules

* Efficient GC needs parallelism, currently limited in Wasm

For a more thorough explanation, see https://wingolog.org/archives/2023/03/20/a-world-to-win-weba...

Performance is less of a concern than binary size. Without WasmGC, you need to ship a compiled garbage collector to the user along with every WASM module written in a GC'd language. That's a lot of wasted bandwidth to duplicate built-in functionality, so avoiding it is a big win! And performance will always be a bit better with a native GC, plus you can share its scheduling with the rest of the browser process.
I think it’s also that the V8 garbage collector already has a stupidly high bar when it comes to optimizations that shipping your own even without any consideration to WASM performance would be a step backwards for most languages running on the web.