
Ask HN: WebAssembly  JavaScript Overhead? - dakom
Is there some good data about the overhead in JS&lt;-&gt;WebGL communication?<p>Specifically, I&#x27;m interested in using JS to handle the view (whether WebGL or DOM) and as like a broker between worker threads, as well as general gluey things and simple app logic - and WebAssembly for some heavy lifting and number crunching.<p>Not sure _exactly_ where the balance of all that would land - but I am curious about the overhead of passing messages between the JS and WebAssembly layers, so that I can consider things a bit more carefully.<p>To pre-empt some answers - I do get that it might make more sense to split that balance more heavily one way or the other, but at this point I&#x27;m just wondering about hard data on what the communication costs.<p>Thanks!
======
Schampu
I recently experimented with this [0] - there is some overhead but it's
acceptable. I noticed that the more arguments you pass over into a Wasm
function, the slower things get (see _.set_ test).

Note: I'm either bad at doing correct benchmarks or the Javascript compiler is
pretty sneaky at optimizing things.

[0] -
[https://maierfelix.github.io/glmw/mat4/](https://maierfelix.github.io/glmw/mat4/)

