3 ms·
> refactoring performance critical code in WebAssembly is not the greatest idea since there's a massive interop overhead You are right. But if done judiciously
by swsieber 7y ago
> refactoring performance critical code in WebAssembly is not the greatest idea since there's a massive interop overhead
You are right. But if done judiciously, it can bring large benifits. The massive interop overhead has also shrunk quite a bit.
Here's a fun article about shrinking the overhead: https://hacks.mozilla.org/2018/10/calls-between-javascript-and-webassembly-are-finally-fast-%F0%9F%8E%89/ https://hacks.mozilla.org/2018/10/calls-between-javascript-a... - IIRC, chrome as added similar optimizations.
And here's a fun article about gaining performance through rewriting in WebAssembly: https://hacks.mozilla.org/2018/01/oxidizing-source-maps-with-rust-and-webassembly/ https://hacks.mozilla.org/2018/01/oxidizing-source-maps-with...
To be fair, I've written a fair amount of Rust. I haven't really gotten the borrow checker, or at least I've only fought it once or twice, and most of my data structures don't need lifetimes. And from my experience, algorithmic things generally don't require you fight it (except graphs and linked structures), which is what I would think you'd try to optimize.
----
Edit: I agree though that it's not as easy as the author makes it out to be.