/webworker-protobuffs

Experiments with communicating with Web Workers using just Transferables.

Primary LanguageTypeScriptMIT LicenseMIT

webworker-protobuffs

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.

Running

  1. yarn
  2. yarn start
  3. Open http://localhost:1234 and view console

License

MIT