sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

Isolate the heavy work of compressing files to a webworker

Open danilowoz opened this issue 3 years ago • 0 comments

Tell us how you think we can improve Sandpack

The process of compressing all files into a string (handled by lz-string) might be very expensive to the main thread, blocking the UI and degrading the experience.

What is this feature?

Instead of performing the compressing process inside the Sandpack component, we could move this logic to a webwoker and optimize the heaviest part of this process.

How would your idea work?

  • Create a webworker;
  • Reuse this webworker for all sandpacks on the page, I don't think we need a specific webworker for each sandpack;
  • Set a loading state in the "Open in CodeSandbox" button, as this will run async;

https://github.com/codesandbox/sandpack/issues/442

danilowoz avatar Apr 22 '22 09:04 danilowoz