Experiments with communicating with Web Workers using just Transferables.
Data types are declared with Protocol Buffers using dcodeIO/protobuf.js and then converted to ArrayBuffer's before being transfered to thw Worker thread with postMessage
.
Preliminary results are that using this method vs. the standard passing of object literals is ~2x slower.
Note: There is currently a bug where subsequent ProtoBuff messages fail due to Protobuff.js reusing the same ArrayBuffer
internally (i.e the one we transfer to the Worker). This could likely be solved by cloning the buffer.
yarn
yarn start
- Open http://localhost:1234 and view console
MIT