I have a web app, and it has some variables in the main program. These variables are objects with lots of strings or arrays in them.
But then it makes 4 web workers. But it then sends the giant object as messages to each web worker. This basically clones the object 4 times.
I want to use the new sharedarraybuffer datatype http://lucasfcosta.com/2017/04/30/JavaScript-From-Workers-to-Shared-Memory.html to be able to have the web workers be able to access the object from the parent, so it can be more memory-efficient.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
How can I do this? The example seems to initialize it by making it based on number of bytes needed. I don't understand how I would calculate that.
Does anyone know how to do this?
Thanks