by still_grokking · 4y ago · 0 comments
Which ones?
AFAIK WSAM runs only "C-like" language properly.
Everything else is a major hack and slow as hell.
When it even exists of course. Because to my knowledge there aren't much languages that compile to WASM besides C/C++/Rust. Because WASM lacks features for VM languages (and that is the big majority of languages). Did something in this regard change lately?
And yeah, I guess we're able to run things in the browser with WASM. One could say "well why use it on a machine outside the browser", to which I reply the obvious thing: hell of a lot easier to just use one VM rather than two.
I think there are also social dynamics at play when it comes to _anything_ related to Oracle, which does poison the well. It's unfair to the GraalVM people's serious work, but it is what it is.
Really? I see marked as "production ready" (whatever this means in this case):
AssemblyScript
Brainfuck
C
C++
Go
Forth
Zig
Rust
COBOL
C#
F#
Lua
Clean
Lobster
TypeScript
Never
So the realistic options are: C/C++, Go, Zig, Rust, C#/F#, and Lua.Where C#/F# is slow as hell, with a gigantic overhead.
Lua is likely slow (don't know for sure).
The rest looks pretty much like "the C languages" to me.
> […] and you don't need special "GC support" in WASM to implement a GC in WebAssembly, at the cost […]
Oh, someone is prepared.
Sure, you can build such thing. One can also build a Web-Browser in Brainfuck; somehow (and than even run it in a WASM container).
The point is that that's extremely inefficient.
In the browser it does even make less sense as there is the JS VM with a pretty solid GC right next to the WASM runtime.
So compiling a VM language to WASM is already questionable in itself. But without proper low-level building blocks to implement managed language runtimes efficiently this can be hardly even called working. Just have a look how for example Blazor compares to native JS (which people consider slow and sluggish already):
https://krausest.github.io/js-framework-benchmark/2022/table...
We're talking about garbage collection though, this will always be inefficient, doesn't matter much on which side of the fence it is implemented. At best you can save some WASM download size by piggybacking on the Javascript engine's garbage collector (that's essentially what the WASM GC proposal is about).
No, that's just not true.
You can't implement GC in WASM currently in any sane way.
As already said more than once here: WASM is lacking needed features. (For example memory fence instructions).
Any GC build in WASM will be extremely slow and inefficient. It will be also a stop-the-world GC. Because you can't build anything else.
GC implemented in WASM is at the moment completely impracticable.
Sure, you "can" do it still. But that's like building a banking application in Brainfuck. You can do that. In theory. Maybe even someone did it "for real". All this does not matter. It's brainfuck.
And that's not only the GC.
VM runtimes, and JITs need some more features to be implemented efficiently.
WASM is also lacking those features (like computed go-to).
Bottom line is: It's impossible to implement a VM in the WASM VM even remotely acceptable.
This is also backed by data:
I've showed already the catastrophic performance of Blazor. (And this is something where millions of dollars went for years to make it even "work".)
Come on, it is a ridiculous claim. GCs can run completely concurrently with the actual code with barely any coordination between the runtime and the running code - they basically make allocation’s and deallocation’s costs asymptotically zero. You do not believe that manual allocations are free, right?