vasturiano/force-graph

Support for WebWorker/OffscreenCanvas

TimonLukas opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
Since the most performance intensive parts of the library on larger scales will be the Canvas parts, a lot of performance could be gained by moving those parts into a WebWorker rendering to an OffscreenCanvas. Especially any larger graphs which currently block the main thread would no longer cause the site itself to block.

Describe the solution you'd like
A new option while instantiating the graph object, which would either:

  • cause the library to spawn a WebWorker for the actual rendering, and transfer control to that (would have to spawn worker)
  • allow the user to supply an OffscreenCanvas as well as a message mechanism between WebWorker and main thread instances (would rely on user spawning worker)

Describe alternatives you've considered
/

Additional context
Since you probably don't want to proxy all events to the Web Worker, splitting the rendering would be the easier way, although it would require mirroring the node state.