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

feat: add fsCache option to improve build performance #56

Merged
merged 2 commits into from
Sep 28, 2024

Conversation

sapphi-red
Copy link
Contributor

This PR adds fsCache option that makes FS requests to be cached.

When this flag is enabled, vitepress build in vitejs/vite gets 2x speed up.

41.72s -> 19.08s (without readFile cache: 25.41s)

I made the default to be false so it needs to be set to true by @shikijs/vitepress-twoslash for build. That said, I didn't find a way to know whether it is dev mode or build mode in ShikiTransformer type. Adding a way to know that might be also needed.

Copy link

netlify bot commented Sep 27, 2024

Deploy Preview for twoslash ready!

Name Link
🔨 Latest commit da0c8f3
🔍 Latest deploy log https://app.netlify.com/sites/twoslash/deploys/66f7a064046e3900086e820e
😎 Deploy Preview https://deploy-preview-56--twoslash.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@antfu
Copy link
Member

antfu commented Sep 28, 2024

I think it would be fine to set to true by default. HMR probably won't work anyway if the referenced source code is changed. It would be more beneficial to have a performant default and opt-out explicit for special case.

@antfu antfu changed the title feat: add fsCache option to improve build performance feat: add fsCache option to improve build performance Sep 28, 2024
@antfu antfu merged commit d8eeff0 into twoslashes:main Sep 28, 2024
9 checks passed
@sapphi-red sapphi-red deleted the feat/fs-cache branch September 30, 2024 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants