Same origin shared memory: index.html + webworker

  1. I have Rust/wasm32 running on index.html.
  2. I also have Rust/wasm32 running on a webworker index.html forks off.
  3. I have the two communicating via postMessage / onmessage
  4. I'm looking for a lower latency solution, based on sharedmemory

Question: is there a crate that does this for me? [Only needs to work on latest Chrome].

Not sure about a crate, but you can check this project:

What sorts of latencies are you looking for? Do you have an estimated budget for how long it can take to send a message between workers, or an approximate throughput you are looking for?

According to Is postMessage slow? — surma.dev the absolute minimum of postmessage is 0.4ms and goes up as the complexity (# nodes, ttl size)of msg goes up. This is a bit scary in dealing with gaming input where 16ms = delayed frame.

1 Like