Using wasm for complex calculations

Hello, folks.

I wondering how DracoCompression class works. decodeMeshAsync method takes data as ArrayBuffer or ArrayBufferView and I don’t know how this data is passed to draco decoder wasm binary. It will copy data from js to wasm? Or it will move this data from js to wasm?

I need to perform some complex calculations with BabylonJS mesh geometry and my algorithm is too slow on narrow phase, so I guess I can take as an example approaches that is used for decompressing draco files using wasm.

So, my main question - is it possible somehow to pass Float32Array of mesh positions data without copying to web assembly binary? Or share the same array with position data between JS and WASM?

If you have any advice or recommendations, please share. Thank you for your attention.

cc @bghgary

I use web workers for this task. I spin off a worker for computational work, which could involve computing meshes, weights, images, etc., and then I pass the results back using postMessage.