You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This works by creating a cache in website/node_modules/.cache/rspack on the first build, which is used to speed up subsequent builds.
It is your responsibility to configure your host/CI to "persist" that cache across CI job runs. We don't really document how to do so currently, but we plan to document how to do this for popular hosts (Vercel/Netlify/GitHub Actions) in the future.
This is a feature we already had with webpack, and is now available starting Rspack v1.2
Work in progress, it's working but cause some troubles
hyperfine --warmup 1 --runs 3 'DOCUSAURUS_NO_PERSISTENT_CACHE=true yarn build:website --locale en''yarn build:website --locale en'
Benchmark 1: DOCUSAURUS_NO_PERSISTENT_CACHE=true yarn build:website --locale en
Time (mean ± σ): 34.257 s ± 1.055 s [User: 113.819 s, System: 19.739 s]
Range (min … max): 33.412 s … 35.439 s 3 runs
Benchmark 2: yarn build:website --locale en
Time (mean ± σ): 27.399 s ± 2.244 s [User: 92.127 s, System: 18.269 s]
Range (min … max): 24.868 s … 29.144 s 3 runs
Summary
yarn build:website --locale en ran
1.25 ± 0.11 times faster than DOCUSAURUS_NO_PERSISTENT_CACHE=true yarn build:website --locale en
Docusaurus Slower vs Docusaurus Faster - Cold builds
This change has no impact on cold builds: Docusaurus Faster is still 3-4x faster overall.
hyperfine --prepare 'yarn clear:website' --runs 3 'DOCUSAURUS_SLOWER=true yarn build: website --locale en''yarn build:website --locale en'
Benchmark 1: DOCUSAURUS_SLOWER=true yarn build:website --locale en
Time (mean ± σ): 126.248 s ± 1.741 s [User: 262.281 s, System: 26.020 s]
Range (min … max): 124.779 s … 128.171 s 3 runs
Benchmark 2: yarn build:website --locale en
Time (mean ± σ): 35.220 s ± 0.454 s [User: 115.600 s, System: 22.074 s]
Range (min … max): 34.808 s … 35.707 s 3 runs
Summary
yarn build:website --locale en ran
3.58 ± 0.07 times faster than DOCUSAURUS_SLOWER=true yarn build:website --locale en
Docusaurus Slower vs Docusaurus Faster - Warm re-builds
With the latest Docusaurus Faster options coming in v3.8, rebuilding your site should be 50% faster. We hope to improve this number even more in the future.
hyperfine --warmup 1 --runs 3 'DOCUSAURUS_SLOWER=true yarn build:website --locale en''yarn build:website --locale en'
Benchmark 1: DOCUSAURUS_SLOWER=true yarn build:website --locale en
Time (mean ± σ): 46.419 s ± 3.417 s [User: 65.154 s, System: 13.887 s]
Range (min … max): 43.875 s … 50.303 s 3 runs
Benchmark 2: yarn build:website --locale en
Time (mean ± σ): 27.518 s ± 2.659 s [User: 90.753 s, System: 17.794 s]
Range (min … max): 25.705 s … 30.571 s 3 runs
Summary
yarn build:website --locale en ran
1.69 ± 0.20 times faster than DOCUSAURUS_SLOWER=true yarn build:website --locale en
ArgosAdd this label to run UI visual regression tests. See argos.yml GH action.CLA SignedSigned Facebook CLApr: new featureThis PR adds a new API or behavior.
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This PR introduces a new Docusaurus Faster option:
siteConfig.future.experimental_faster.rspackPersistentCache
.It permits Docusaurus to (re)-build your site much faster on subsequent builds.
You can turn it on globally (recommended) alongside other Docusaurus Faster options:
Or individually:
This works by creating a cache in
website/node_modules/.cache/rspack
on the first build, which is used to speed up subsequent builds.It is your responsibility to configure your host/CI to "persist" that cache across CI job runs. We don't really document how to do so currently, but we plan to document how to do this for popular hosts (Vercel/Netlify/GitHub Actions) in the future.
This is a feature we already had with webpack, and is now available starting Rspack v1.2
Work in progress, it's working but cause some troubles
Fix #10823
Test Plan
CI + local + dogfood
Test links
https://deploy-preview-10931--docusaurus-2.netlify.app/
Docs: https://deploy-preview-10931--docusaurus-2.netlify.app/docs/api/docusaurus-config/#future
Benchmarks
Disclaimer: Rspack has a bug that prevents many of our files from being cached efficiently.
In practice, the cache doesn't work yet for all code-generated files, that are common to the Docusaurus ecosystem:
./docusaurus
We hope to improve these benchmarks soon. The Rspack bug is tracked here:
Until then I reverted a little bugfix that prevents Rspack from optimizing docs MDX files: #10934 (we'll re-enable it later)
Faster (no cache) vs Faster (with cache) - Warm re-builds
The Rspack persistent cache improves build time by ~25%.
This is not as impressive as we hoped, but this should improve in the future with:
Docusaurus Slower vs Docusaurus Faster - Cold builds
This change has no impact on cold builds: Docusaurus Faster is still 3-4x faster overall.
Docusaurus Slower vs Docusaurus Faster - Warm re-builds
With the latest Docusaurus Faster options coming in v3.8, rebuilding your site should be 50% faster. We hope to improve this number even more in the future.