DEV Community

Discussion on: Is it just me or are we in a low-hype phase?

 
frothandjava profile image
Scot McSweeney-Roberts

any major distinguishing factors between the two that might make WASM more successful than the JVM as a super-platform?

20 years of development in JIT compilers.

Thread Thread
 
kenbellows profile image
Ken Bellows

So then, is it really just JVM 2019? Nothing systematically different between the two, it's just more efficient at JIT? It's all just down to performance, not a matter of WASM doing something fundamentally different to the JVM or us using it differently or anything?

Thread Thread
 
frothandjava profile image
Scot McSweeney-Roberts

IIRC, the JVM didn't JIT at all back when applets first appeared. By the time it did it was too late and people equated Java with poor performance.

I suppose WASM is more tied in to the browser than the JVM tended to be. So that's a bit different (if you don't include any browser that was written in Java).

The programming model is different. Applets had a fairly well defined shape. WASM is more anything goes. Not sure if that really qualifies as fundamentally different though - it's certainly solving the same sorts of problems that Applets, ActiveX, Flash and Silverlight were meant to solve.

 
rhymes profile image
rhymes

@kenbellows , I'll try to answer :)

But regarding the proprietary code problem, haven't we tried this before with the JVM? It did pretty well for a while, but hasn't really solved the cross-platform problem.

WebAssembly's binary format is an open standard and can be reverse engineered. There's a text version of the binary and I'm sure "view source" tools will pop up when mainstream. You can already go from text to binary with command line tools. Is it super readable? No. But it's not proprietary. This is the first difference.

Another difference is that it's designed from the start to be cross platform, and already is: it's cross browser and cross platform.

Yet another difference is that all the major companies are backing it: Mozilla, Microsoft, Google, Apple are all in it and the major browsers support the 1.0 specification (backed by the W3C). An example implementation that's already in production is the one by Figma which used to speed up their design tool:

As you can see, our load time improved by more than 3x after we switched to WebAssembly regardless of document size. This is a huge improvement for our users, who often create very large design documents and frequently switch between them.

An additional load time benefit of WebAssembly that isn’t captured in this graph is that load time no longer depends on application size. As long as users have loaded the app before, the browser should already have the translation from WebAssembly to native code cached from last time.

WebAssembly doesn't need to be recompiled everytime so that's a plus :)

This is really a great intro if you want to understand it better: WebAssembly. Neither Web Nor Assembly, All Revolutionary

Was that a reference to security issues, or performance, or just the "compile everything to JVM bytecode instead of writing JS" trend of the 2000s, or something else?

No I just think they are two different things even if at the surface they can seem similar. WebAssembly can potentially be used as an applet. Drop a binary in a page and play a 3D game completely disconnected from the web around it. But it goes beyond that.