Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: performance improvements #295

Closed
danilowoz opened this issue Jan 11, 2022 · 9 comments
Closed

Feature request: performance improvements #295

danilowoz opened this issue Jan 11, 2022 · 9 comments

Comments

@danilowoz
Copy link
Member

danilowoz commented Jan 11, 2022

This issue aims to centralize all concerns related to performance and what actions Sandpack is taking to solve them.

How to skip the transpiled step? Or how to load pre-transpiled code?
We have already addressed an internal solution for it, which aims to cache all compiled files and share them between sandboxes with the same dependencies.

Why codesandbox.io loads faster than Sandpack?
We use the exact same bundler in codesandbox as is published with the sandpack package, so actual bundling/transformation speed should be identical. However, on CodeSandbox we have a server-side redis cache which makes initial loads almost instant as it does not need to transpile anything initially. Again, we have some things planned to make this better for all sandpack users (a cache that isn't tied to a sandbox and some other improvements).

Related #292, #271, #259

@christian-schulze
Copy link

christian-schulze commented Jan 11, 2022

This is sounding really promising!

In the meantime, I've hacked together a working solution for loading pre-transpiled code here:

Looking forward to making use of the official feature when its ready 🎁

@joshwcomeau
Copy link
Contributor

I'm thrilled to hear you're working on this 💯

In my own usecase, I have a "fullscreen" button that transfers to a new Sandpack in a Portal. Right now, there's a really noticeable transpile step as the component has to start from scratch:

sandpack-no-cache.mp4

If I only have to pay that transpile cost when the page first loads, it would greatly improve the user experience.

Thanks so much for your work on this project!

@danilowoz danilowoz added this to To do in Sandpack roadmap Jan 25, 2022
@danilowoz danilowoz moved this from To do to Triage in Sandpack roadmap Jan 25, 2022
@danilowoz danilowoz moved this from Triage to Next up in Sandpack roadmap Feb 1, 2022
@PeterDraex
Copy link
Contributor

@danilowoz Could you provide a time frame when the cache feature could be released? Are we talking weeks or months?

@danilowoz
Copy link
Member Author

I think we're on a stable version, and soon (a few weeks or less) we'll be able to introduce a beta version of Sandpack Bundler V2. But I can advance that initially, it will only work for React templates, is that ok for you?

@PeterDraex
Copy link
Contributor

@danilowoz Will TypeScript be supported?

@danilowoz
Copy link
Member Author

Yes, but it depends on what you mean by supporting Typescript:

  • Language server/consume compile error: yes, you can check the implementation here TypeScript integration #237
  • Compile Typescript files: yes, thought babel compiler;

@PeterDraex
Copy link
Contributor

Is this already available in #375?

@danilowoz
Copy link
Member Author

ok, let's make it official, please read #416

😄

@danilowoz danilowoz moved this from Next up to Done in Sandpack roadmap Mar 21, 2022
@danilowoz
Copy link
Member Author

danilowoz commented Mar 28, 2022

@joshwcomeau, I'm curious to know if you gave the new bundler a try. We made some significant improvements and progress toward removing dependencies and transpile overhead. Feel free to direct me on Twitter or discord to discuss more about it.

I'm looking forward to understanding how we can help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

5 participants