I'm working on a CPU and memory intensive project for which some of the processing is sent to a web worker in order to not hang the browser while its number crunching. The problem I am facing is that I need to send to the web worker instance a few multidimensional arrays, but upon profiling the app I realized it was cloning the arrays, so I'l trying to see if I pass them as transferable objects.
For simplicity assume that the arrays I'm trying to pass are:
var myArray1 = [{a: 0, b: "0"}, {a: 1, b: "0"}];
var myArray2 = [{c: 0, d: "0"}, {c: 1, d: "0"}];
Is there a way to pass these as transferable objects to a web worker instance?