WebAssembly proposals tracker: https://github.com/WebAssembly/proposals
WebAssembly reference types (https://github.com/WebAssembly/reference-types/blob/master/p...) looks like the blocker for a lot of things, and it's in the final spec phase at least.
In Chrome, it's behind a flag since 78, which went stable in Oct 22 2019: https://chromestatus.com/features/5166497248837632 But also under active development? https://bugs.chromium.org/p/v8/issues/detail?id=7581
Supposedly implemented in Firefox two years ago: https://bugzilla.mozilla.org/show_bug.cgi?id=1444925
Nothing in Safari, of course.
Where is it now though?
Reference types already implemented. GC is not really needed for non-managed languages like C++ or Rust. Interface types in progress.
See this: https://webassembly.org/roadmap
And the fact that Mozilla has problems and has to realign is certainly not helping.
I disagree.
I can already write decent C# applications that run in browser while using already existing C# libraries for e.g parsing text and it will run fine.
So, WebAssembly allows me to use existing code C# and move it to the browser while developing in my fancy language instead of Javascript and I think it (dropping js) is very solid pros
I just think tooling (visual studio, vs code, rider, etc...) around C#'s Blazor has to mature in order to make this kind of development worth considering, but I wouldnt call that "long way to go"
It is undoubtedly technically possible, but not really practicable, unless you accept an exorbitant speed-down and much higher memory consumption than e.g. when running in DotNet. Personally, I don't find that attractive in any way, nor do I find it particularly efficient.
I think DLLs size and lack of DOM access was the biggest problem at the moment I've been testing it
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.
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.
IMHO the current main problem of WASM running in browsers is not WASM, but that most "HTML5 APIs" are too high level, too specialized, and built under the assumption that Javascript is too slow to allow lower level, more general APIs (worst example of this outdated thinking is WebAudio).
The next problem is: browser updates regularly break things, often unintended, but sometimes intended (like Chrome's splendid decision to start WebAudio contexts muted, which broke pretty much every WebAudio demo on the web).
And finally: Features behind "security gates", some features just show a passive popup - but not that different browsers could ever agree on what the best UX is for this, each one behaves differently), other features show a popup that requires a user interaction. Other feature can only be used from within in a "short-lived input event handler". Yet other features only work over a HTTPS connection. And yet other features require specific response headers to be set by the web servers (like SharedArrayBuffer support in Firefox, and probably soon-ish Chrome).
Please browser vendors I beg of you, make up your damn mind already about how to handle such security-sensitive features in a consistent way.
Then there's the always lingering deprecation threat, like WebAudio's ScriptProcessorNode, despite it working perfectly fine for situations where audio samples must be generated on the browser thread and audio synthesis can't be moved into the audio thread)
All of this combined makes the browser platform a quite frustrating platform to work on for anything that isn't very simple webpages. Not as bad as Android development (which is at the bottom of my list), but it's starting to get close.
PS: Despite my ranting, I do actually like writing WASM stuff and putting it up on the web, at least this can be done without going through hoops like on closed platforms (e.g. Android or iOS). But it really could be better. Most of the actual problems are not something the people working on WASM can do anything about though.
But that's exactly what happens when you draw into an SDL raster window. Even when you have vector drawing operations on higher level, eventually pixels are modified; you can of course combine drawing operations and transport a patch of the screen to the host, but this still goes through an impressive machinery with a lot of copying.
> All of this combined makes the browser platform a quite frustrating platform to work on for anything that isn't very simple webpages
Well, eventually we're on the same page.
The way to handle something like setting unique pixels is to keep a pixel buffer in memory on the WASM side, set the pixels in there, and then once per frame copy this pixel buffer into a WebGL texture and render this through a single WebGL draw call, or blit the pixel buffer to a 2D canvas if WebGL is not an option (also once per frame).
There's even a HN clone built on Blazor [5]. This very thread can be found there.
[1] https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor
[2] https://devblogs.microsoft.com/aspnet/blazor-webassembly-3-2...
[3] https://becksblazor.azurewebsites.net
[4] https://github.com/StevenTCramer/awesome-blazor#samples-and-...
That has not been what I've seen from it. People have made video editors and ported game into web pages. You make a lot of claims in this thread about speed and memory but don't back any of them up.
EDIT: I'm using Firefox 78.0.2 on Linux i386.
FF memory usage: blank page = 285MB, peak = 839MB, steady-state = 340MB. Load time: ~6s wall clock time.
Tried it with my Windows 10 Desktop too (i7 quad core, 32GB RAM, Firefox 80.0.1).
FF memory usage: blank page = 215MB, peak = 1015MB, steady-state = 658MB. Load time: ~3s wall clock time.
Once loaded, the UI was very responsive.
Btw. I noticed that on my machine memory use is higher on Chromium and performance even worse than with Firefox. So it seems to depend on browser type/version, and someone in this thread said that there is no support for Safari.
This is for a pure logic component of course