News for hackers. Stuff that matters.
Re:Is WebAssembly magic performance pixie dust? by slx26 on Wednesday April 14, 2021 @03:44AM (#26804161)
And there might be other benefits besides performance. I'd like to use WASM to be able to reuse server side code in languages like Rust or Go in the client, so you don't have to re-implement algorithms and tricky processing code in javascript.
Re:Is WebAssembly magic performance pixie dust? by vbsteven on Wednesday April 14, 2021 @04:14AM (#26804357)
I experimented with this some weeks ago and it is certainly possible.

I had a PoC where my server runs Rust, exposes a JSON Rest API using serde to serialize my Rust structs to JSON. On the web Client I compiled Rust to wasm and used the Reqwest crate (http client that uses Fetch in wasm) to talk to my server, Rust structs are shared between server and client.

For me, the beauty about Rust in this setup, is that cross compiling/crossplatform is builtin into the tooling (Cargo). For example the Reqwest crate compiles down to use the browser Fetch api when running in Wasm, and the same crate on the server uses a native implementation using openssl (or rusttls).

Re:Is WebAssembly magic performance pixie dust? by kevincox on Wednesday April 14, 2021 @09:25AM (#26806741)
I did something making a game. The game logic runs server side however in order to hide latency the clients also run a WASM copy locally. Then once the server processes their moves they check that everything was in-sync and if not reload with the server state.

(In practice the validation is probably not necessary but doesn't hurt to have).

Re:Is WebAssembly magic performance pixie dust? by rapsey on Wednesday April 14, 2021 @04:33AM (#26804441)
I even use druid for a simple browser gui on top of a rust json rest service. For an internal tool. Serde on both ends. Works great.
Re:Is WebAssembly magic performance pixie dust? by xupybd on Wednesday April 14, 2021 @03:54AM (#26804230)
Dot net does this with Bolero. I need to give it a go.
Re:Is WebAssembly magic performance pixie dust? by edflsafoiewq on Wednesday April 14, 2021 @04:04AM (#26804293)
asm.js suffices for that.
Re:Is WebAssembly magic performance pixie dust? by TheCoelacanth on Wednesday April 14, 2021 @09:43AM (#26806938)
Asm.js is a non-standard precursor to wasm.
Re:Is WebAssembly magic performance pixie dust? by jholman on Friday April 16, 2021 @02:39AM (#26830385)
You know a technique, based on asm.js, that lets you use Rust or Go in the browser?