Live data from Hacker News

Analyzing the Performance of WebAssembly vs. Native Code

ar5iv.labs.arxiv.org

11–20 of 59 posts

Re: Analyzing the Performance of WebAssembly vs. Native Code

#15
45% slower seems pretty decent considering they use a wasm kernel they developed to mimic the unix kernel so they can run non-modified unix programs inside the browser. It's actually pretty impressive that they did this, and even more impressive that it works and like another commentator said, is not even an order of magnitude slower.

I'm more interested in 1) usages of wasm in the browser that don't involve running unmodified unix programs and 2) wasm outside the browser for compile-once-run-anywhere usecases with sandboxing / security guarantees. Could it be the future for writing native applications?

Languages like Kotlin, C#, Rust, as well as C/C++ etc support wasm quite well. Could we see that be a legitimate target for applications in the future, if the performance gap was closer to 10%-ish? I would personally prefer running wasm binaries with guaranteed (as much as possible ofc) sandboxing compared to raw binaries.

edit: it's from 2019, there have been significant improvements made to wasm since then.

Re: Analyzing the Performance of WebAssembly vs. Native Code

#16
post #3

45% slower to run everywhere from a single binary... I'll take that deal any day!

45% slower to run everywhere from a single binary... with less security holes, without undefined behavior, and trivial to completely sandbox. Its definitely a good deal!

Native code generally doesn't have undefined behaviour. C has undefined behaviour and that's a problem regardless of whether you're compiling to native or wasm.

Re: Analyzing the Performance of WebAssembly vs. Native Code

#17

45% slower means..? Suppose native code takes 2 units of time to execute. “45% slower” is??? Would it be 45% _more time?_ What would “45% _faster_” mean?

0% slower means "the same speed." The same amount of seconds.

10% slower means "takes 10% longer." 10% more seconds.

So 45% slower than 2 seconds is 1.45 * 2 = 2.9 seconds.

Re: Analyzing the Performance of WebAssembly vs. Native Code

#19

45% slower means..? Suppose native code takes 2 units of time to execute. “45% slower” is??? Would it be 45% _more time?_ What would “45% _faster_” mean?

It’s a fair point, that way of expressing it is always a bit confusing. Is it the original time plus 45%? Is it 45% of the original speed?

I think it is easier to understand in terms of throughput.

So 45% less work per unit of time, so 55% of the work.

Re: Analyzing the Performance of WebAssembly vs. Native Code

#20

... in browsers. Which at best JIT compile. There are several WASM runtimes that AOT compile and have significantly better performance (e.g. ~5-10% slower). The title is highly misleading.

Browsers have been doing (sometimes tiered) AOT compilation since wasm inception.
Post reply on HN