tl;dr - examples (currently requires chrome):
>with web worker (should be smoother)
I thought it was a pretty good candidate for taking the processing off to a web worker; which turned out pretty well.
It was pretty straightforward to pull the code into a web worker, I spent a bit of time before I realised that console.logs were making it fall over. Here’s the interface for responding to messages with the worker:
Back in the original page, you can creater the worker and deliver messages to it using the
.postMessage function. You can optionally list Transferable objects to efficiently move them to the web worker.