Hacker News new | ask | show | jobs
by InkCanon 236 days ago
Could you explain more on what bindgen was lacking and what you did different?
1 comments

wasm-bindgen generates a lot of marshalling code on both sides with dynamic allocations and this kills performance.

For low-level algorithms, this means that JS + wasm-bindgen will only be marginally faster than pure JS - the overhead of crossing the boundary is that much of an issue: https://dev.to/bence_rcz_fe471c168707c1/rust-webassembly-per...

With zaw, it uses a pre-allocated, fixed-width buffer for communication, same technique as Bence uses in that article.

It's a night and day difference.