News for hackers. Stuff that matters.
Re:Hands-on WebAssembly by the_duke on Wednesday August 26, 2020 @04:36AM (#24280421)
Go has to embed it's runtime and GC into builds, so build size and performance will take a hit here. Same goes for most popular languages.

For me Rust offers the best WASM experience and tooling at the moment.

Rust has no GC and (almost) no runtime.

It also has official wasm build target support out of the box, including generating Typescript definitions for Rust types.

The ecosystem is somewhat well-developed:

* wasm-bindgen for general interop in both directions

* js-sys / web-sys for (low-level) type-safe and surprisingly efficient browser API bindings

* wasm-bindgen-futures for easy Promise <-> Future interop

* wasm-pack for easy building

* ...

Getting the code size low is still a challenge though.

A Rust implementation of the Krausest frontend framework benchmark takes a top 4 spot [1]. Despite this benchmark not favouring wasm at all since it requires little computation and mostly does FFI calls.

(ps: C++ is in a decent state as well)

[1] https://rawgit.com/krausest/js-framework-benchmark/master/we...

Re:Hands-on WebAssembly by pansa2 on Wednesday August 26, 2020 @06:53AM (#24281231)
> C++ is in a decent state as well

I’d still choose Go or Rust over C++, though, because they’re memory-safe. This recent discussion shows that’s still important in the context of WebAssembly: https://news.ycombinator.com/item?id=24216764

Re:Hands-on WebAssembly by the_duke on Wednesday August 26, 2020 @08:36AM (#24281820)
Sure, for new projects I choose Rust over C++ whenever feasible.

But a huge amount of the worlds software is written in C++, and will remain so for decades.

Getting some of that code to run well in WASM can be a big win for certain domains.

Re:Hands-on WebAssembly by stjohnswarts on Wednesday August 26, 2020 @05:41PM (#24287614)
Modern C++ has a lot of memory safe operations if you use them (smart pointers, atomics, actually using RAII properly and universally), although I'm not sure how much overhead they might add to a wasm blob. Rust seems almost perfect for it though, but no reason to discourage C++ people; it can be a relatively modern language if you let it.
Re:Hands-on WebAssembly by pjmlp on Thursday August 27, 2020 @07:52AM (#24292728)
As someone that loves still having C++ on the toolbox, that is unfortunately only true if you have 100% control over the source code and have all team on modern C++ mindset.
Re:Hands-on WebAssembly by amelius on Wednesday August 26, 2020 @06:50AM (#24281213)
> Go has to embed it's runtime and GC into builds, so build size and performance will take a hit here

I expect that WASM doesn't have the concurrency model required by a modern concurrent garbage collector like Go's, but perhaps I'm wrong.

Re:Hands-on WebAssembly by foota on Wednesday August 26, 2020 @05:11PM (#24287314)
It's likely much slower, but it should be able to run just fine single threaded as well.
Re:Hands-on WebAssembly by pjmlp on Wednesday August 26, 2020 @05:38AM (#24280787)
It is still much smaller than most SPA used to display static text.