umap-js icon indicating copy to clipboard operation
umap-js copied to clipboard

Investigate using a web worker?

Open cannoneyed opened this issue 6 years ago • 5 comments

cannoneyed avatar May 03 '19 18:05 cannoneyed

I am curious about your plans. Are you planning to integrate webworker support natively? I was able to wrap UMAP-js in a webworker and it seems to work fine.

flekschas avatar Feb 15 '20 00:02 flekschas

Yeah, it's pretty straightforward to wrap up in a web worker if you need to, but it'd be extra awesome if the lib could bootstrap itself into a web worker if it was so configured... I think this is actually a really wild, tricky thing to do (and probably isn't worth the effort), but it sure would be neat!

cannoneyed avatar Feb 20 '20 21:02 cannoneyed

I've packaged Workers into libraries before, and this would be useful to me as well, so I'm going to give it a shot. LMK if for some reason you're not open to a PR on this! I'll aim for backwards-compatibility with the current imports of course. That is, current imports will still be non-Worker, but there will be another set of imports that will put the compute in a Worker.

jebeck avatar Mar 04 '20 00:03 jebeck

Hi all @flekschas @cannoneyed @jebeck, can you share your script?

igaloly avatar Jul 26 '22 04:07 igaloly

@igaloly For one approach see:

  • https://github.com/flekschas/piling.js/blob/master/src/umap.js
  • https://github.com/flekschas/piling.js/blob/master/src/umap-worker.js

flekschas avatar Jul 26 '22 12:07 flekschas