top | item 30112573

(no title)

gk1256 | 4 years ago

I can dislike Rust too, but the facts are facts. Emscripten is the leader of WASM world and lot of its code is based on C++.

discuss

order

pacificat0r|4 years ago

Emscriptem is targeted at browsers and for that rust does have the target wasm32-unknown-emscripten

However, when targeting wasm outside browsers wasm32-wasi is usually a better option.

jedisct1|4 years ago

When targeting WASI or for standalone (no wasi, no emscripten) WebAssembly, Zig is currently the best option, IMHO.

Modules are small and fast, virtually all existing code is compatible out of the box and the standard library comes with full WASI support. And enabling runtime-specific optimizations such as SIMD is as simple as adding a compilation target flag.

While I maintain quite a few Rust crates specifically designed for WebAssembly/WASI usage, my personal experience is that Zig is often better, even from a performance perspective.

TinyGo is also amazing at producing optimized modules, and a lot of existing Go code can be compiled with it without any changes.

gk1256|4 years ago

"Emscripten" can target platform outside browsers. You have STANDALONE_WASM flag for that.