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

chore: upgrade Docusaurus, enable Faster - Rspack/SWC/LightningCSS #2997

Merged
merged 3 commits into from
Nov 8, 2024

Conversation

slorber
Copy link
Contributor

@slorber slorber commented Oct 25, 2024

Docusaurus v3.6 had Docusaurus Faster options.

I'm testing it on a few sites before the release.

Benchmark

Cold builds - much faster:

hyperfine --prepare 'yarn --cwd website clear' --runs 3 'DOCUSAURUS_FASTER=false yarn build:docusaurus' 'DOCUSAURUS_FASTER=true yarn build:docusaurus'


Benchmark 1: DOCUSAURUS_FASTER=false yarn build:docusaurus
  Time (mean ± σ):     26.333 s ±  0.075 s    [User: 67.591 s, System: 7.877 s]
  Range (min … max):   26.248 s … 26.388 s    3 runs

Benchmark 2: DOCUSAURUS_FASTER=true yarn build:docusaurus
  Time (mean ± σ):      8.062 s ±  0.348 s    [User: 15.819 s, System: 1.906 s]
  Range (min … max):    7.660 s …  8.272 s    3 runs

Summary
  DOCUSAURUS_FASTER=true yarn build:docusaurus ran
    3.27 ± 0.14 times faster than DOCUSAURUS_FASTER=false yarn build:docusaurus

Warm rebuilds - same time (for now):

DOCUSAURUS_FASTER=false yarn build
hyperfine --runs 3 'DOCUSAURUS_FASTER=false yarn build:docusaurus' 'DOCUSAURUS_FASTER=true yarn build:docusaurus'


Benchmark 1: DOCUSAURUS_FASTER=false yarn build:docusaurus
  Time (mean ± σ):      7.934 s ±  0.356 s    [User: 10.059 s, System: 1.205 s]
  Range (min … max):    7.727 s …  8.345 s    3 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Benchmark 2: DOCUSAURUS_FASTER=true yarn build:docusaurus
  Time (mean ± σ):      8.119 s ±  0.549 s    [User: 15.756 s, System: 1.909 s]
  Range (min … max):    7.656 s …  8.725 s    3 runs

Summary
  DOCUSAURUS_FASTER=false yarn build:docusaurus ran
    1.02 ± 0.08 times faster than DOCUSAURUS_FASTER=true yarn build:docusaurus

Copy link

netlify bot commented Oct 25, 2024

👷 Deploy request for babel-next pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit a8f1183

Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for babel ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a8f1183
🔍 Latest deploy log https://app.netlify.com/sites/babel/deploys/6728bc99b9448f0008fb0c20
😎 Deploy Preview https://deploy-preview-2997--babel.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.

@slorber slorber changed the title chore: upgrade Docusaurus, enable Faster chore: upgrade Docusaurus, enable Docusaurus Faster: Rspack, SWC, LightningCSS) Oct 25, 2024
@slorber slorber changed the title chore: upgrade Docusaurus, enable Docusaurus Faster: Rspack, SWC, LightningCSS) chore: upgrade Docusaurus, enable Faster - Rspack/SWC/LightningCSS Oct 25, 2024
@slorber
Copy link
Contributor Author

slorber commented Oct 25, 2024

Just realized I'm upgrading the Babel website to use SWC 😅 hope you are fine with this

@slorber slorber marked this pull request as ready for review November 4, 2024 12:23
@slorber
Copy link
Contributor Author

slorber commented Nov 4, 2024

PR ready to review @nicolo-ribaudo, v3.6 is out:
https://docusaurus.io/blog/releases/3.6

@@ -119,6 +119,10 @@ function remarkDirectiveBabel8Plugin({ renderBabel8 }) {
}

const siteConfig = {
future: {
// See https://docusaurus.io/blog/releases/3.6
experimental_faster: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slorber Thank you for the PR. Will docusaurus 4 remove this option and completely switch to Rspack/SWC/LightningCSS?

Copy link
Contributor Author

@slorber slorber Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

I think we'll keep it for v4, but maybe it will become true by default.

It's also possible to enable all the other options except replacing Babel loader by SWC if you really want your site to use Babel.

Note: if you want to keep Babel, we have a {webpack: {jsLoader: fn}} hook to plug your own custom loader. Even if we remove the faster options and make SWC the default, this hook remains an escape hatch to use Babel, OXC, Esbuild, or whatever you want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm personally fine with using SWC, as long as there is an opt out if we'll ever need it.

@nicolo-ribaudo
Copy link
Member

Nice numbers :)

@nicolo-ribaudo nicolo-ribaudo merged commit 0e31de8 into babel:main Nov 8, 2024
4 checks passed
@slorber
Copy link
Contributor Author

slorber commented Nov 8, 2024

Thanks 🥳

CleanShot 2024-11-08 at 18 20 22

Wasn't that long before but still cool to see the overall build time reducing

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.

3 participants