Live data from Hacker News

Analyzing the Performance of WebAssembly vs. Native Code

ar5iv.labs.arxiv.org

41–50 of 59 posts

Re: Analyzing the Performance of WebAssembly vs. Native Code

#41

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…

> wasm outside the browser for compile-once-run-anywhere usecases with sandboxing / security guarantees

I've been using it this way for DecentAuth[0]. It's awesome. I compile a single native codebase to wasm, and I can use my library from JS, Go, or Rust. New host languages only require about 1000 lines of glue. I don't have to worry at all about building for different architectures.

[0]: https://github.com/lastlogin-net/DecentAuth

Re: Analyzing the Performance of WebAssembly vs. Native Code

#42
post #28
post #11

Earlier quoted context omitted.

That which is old is new again. The wheel keeps turning… “Wait we can use Java to run anywhere? It’s slow but that’s ok! Let’s ride!”

There's a reason Java applets got deprecated in every browser. The runtime was inherently insecure. It just doesn't work for the web. Also, targeting the JVM forces you to accept garbage collection, class-based OO and lots of pointer chasing. It's not a good target for most languages. Java's pretty good, but wasm is actually a game changer.

The Java runtime isn't any more inherently insecure than the JavaScript runtime, and JavaScript seems to work just fine for the web.

The key reason why applet security failed was because it gave you the entire JDK by default, and so every method in the JDK needed to have explicit security checking code in place to restrict access. The model was backwards -- full control by default with selective disabling meant that every new feature in the JDK is a new vulnerability.

Re: Analyzing the Performance of WebAssembly vs. Native Code

#43
post #7

... 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.

It’s not misleading to measure the performance of Web Assembly in a web browser .

WebAssembly is neither web nor assembly. It’s a low level byte code format most similar to LLVM IR.

Re: Analyzing the Performance of WebAssembly vs. Native Code

#44

... 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.

could you please name them?

WAMR (WebAssembly Micro Runtime), wasm2c in WABT (WebAssembly Binary Toolkit), Wasmtime.

Re: Analyzing the Performance of WebAssembly vs. Native Code

#45
post #24

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…

wasm outside the browser for compile-once-run-anywhere usecases with sandboxing / security guarantees Please just use Docker in a microVM or whatever. It's 0% slower and 100% more mature.

Please just use a custom FPGA hand-coded to the exact specifications of the program. It's even less than 0% slower than Docker in a microVM, and unlike Docker, it at least provides one of the two benefits that you quoted from the parent comment. Good thing we already changed the parameters of what they said they're looking for!

Re: Analyzing the Performance of WebAssembly vs. Native Code

#46
post #38

Earlier quoted context omitted.

Fair. Running in the browser isn't novel, but JS/TS are some of the most popular languages in history and that almost certainly never would have happened without monopolizing the browser. Expanding margins are fine by me. Anticompetitive markets are not. My hope is that wasm helps to break a couple strangleholds over platforms (cough cough iOS cough Android)

I really don’t think Apple is going to let anyone get away with too much browser appifying of iOS.

It's not a question of Apple letting anyone do anything. It's just a question of governments forcing it to do so.

Re: Analyzing the Performance of WebAssembly vs. Native Code

#47
post #24

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…

wasm outside the browser for compile-once-run-anywhere usecases with sandboxing / security guarantees Please just use Docker in a microVM or whatever. It's 0% slower and 100% more mature.

Even for small plugins in your app?

Re: Analyzing the Performance of WebAssembly vs. Native Code

#49
post #28
post #11

Earlier quoted context omitted.

That which is old is new again. The wheel keeps turning… “Wait we can use Java to run anywhere? It’s slow but that’s ok! Let’s ride!”

There's a reason Java applets got deprecated in every browser. The runtime was inherently insecure. It just doesn't work for the web. Also, targeting the JVM forces you to accept garbage collection, class-based OO and lots of pointer chasing. It's not a good target for most languages. Java's pretty good, but wasm is actually a game changer.

How does .Net stack up?

Re: Analyzing the Performance of WebAssembly vs. Native Code

#50
post #27

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?

What looks like the relevant table has a summary line saying "geometric mean: 1.45x" so I think that in this case "45% slower" means "times are 1.45x as long". (I think I would generally use "x% slower" to mean "slower by a factor of 1+x/100", and "x% faster" to mean "faster by a factor of 1+x/100", so "x% slower" and "x% faster" are not inverses, you can perfectly well be 300% faster or 300% slower, etc. I less conf…

What would 300% faster mean?

If the original process took 30 minutes to process 10 items, how long would the 300% faster method take?

Post reply on HN