Even if true, it doesn't help much if you have to marshall through JS for nearly every call.
> You can write an entire front end web application if you want
One of the core benefit propositions was the possibility to write browser applications in any language, not just JS.
Outside of a few hobbyists, nobody is writing entire web applications in wasm. We already have great frameworks for dealing with UI/DOM stuff.
"Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications."
So did they mean only GUI-less client applications?
EDIT: also e.g. this source https://developer.mozilla.org/en-US/docs/WebAssembly/Concept... makes it clear that porting e.g. C++ GUI applications is an intended feature, not just a silly idea of some hobbyists.
My favorite example is Rapier http://rapier.rs/, check out the 3D demos. It blows every JS physics engine out of the water, and it’s using Conrod, a native gui library which has a webgl backend.
"WebGL is fully integrated with other web standards, allowing GPU-accelerated usage of physics and image processing and effects as part of the web page canvas"
So I would guess that when your graphics chip is faster than mine you get a higher performance.
This is a physics engine running on your CPU, not your GPU.
The webgl window is run with your GPU and is extremely simple. Drawing a few dozen boxes is something graphics cards from 22 years ago would have no problem with.
I tried that on a 4k monitor, and it ran quite slowly. I then made the window smaller, and it ran much faster. It's bottlenecked on the graphics, not on the physics engine.
If someone says "webasm is slow, this demo took 45 seconds to run" and you say "it ran slow for me when I made the window so big that between my browser's webgl implementation, my gpu drivers and my graphics card, a hundred cubes make everything run at 1/10th the speed" what point is that making?
Ammo js: http://kripken.github.io/ammo.js/examples/webgl_demo/ammo.ht...
Ammo wasm: http://kripken.github.io/ammo.js/examples/webgl_demo/ammo.wa...
They can be faster, but it is still insane how fast JS interpreters have become. So for smaller application it might be ok to stay in JS land.
If your particular front end code is dominated by many calls to the DOM, then WASM may be a net performance loss currently, yes.
In cases where you are doing something computationally heavy then periodically updating the dom with results, then WASM can be a huge win.
In cases where the performance is fine either way, being able to use one language server and client is a huge win. I am already doing useful things with WASM and Rust. It is a very very nice workflow.
Of course I was making sure to do as minimal memory transfer as possible, and I already use a lot of weird patterns to try to minimize GC in JS.
https://github.com/magcius/noclip.website/blob/master/src/gx...
https://github.com/magcius/noclip.website/blob/master/src/as...
If you're doing a lot of cheap calls, it's probably not the optimal way to get a performance boost. I think Web Assembly shines at taking an expensive function, and doing it faster. For example, let's say I wanted to multiple a few large matricies of values. In Javascript this would be VERY slow. In Web Assembly it would be a bit faster, but then Web Assembly plus Web GPU allows me to do it REALLY fast. Yes, I'd then have to marshal the end result back to javascript but that's still cheaper then trying to do all that math natively in Javascript.