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

refactor(core): internalize, simplify and optimize the SSG logic #9798

Merged
merged 45 commits into from
Feb 8, 2024

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Jan 26, 2024

Motivation

Our static site generation logic initially comes from an unmaintained Webpack plugin, that we forked:

It's time to re-internalize this code, remove some unused code, and remove friction to be able to more easily optimize it.

This:

  • decouples the SSG pipeline from webpack
  • refactor/clean all webpack configs and start/build scripts
  • add a basic perf logging system (internal for now)
  • optimize SSG pipeline
  • reduce server bundle size, moving dependencies (eta, minifier) out of the server bundle

The build time perf wins are not huge, because SSG executes relatively fast compared to the bundling phase.

yarn clear && yarn install && yarn build:website --locale en && hyperfine --runs 5 'yarn build:website --locale en'

Before
  Time (mean ± σ):     39.741 s ±  1.187 s    [User: 44.686 s, System: 6.152 s]
  Range (min … max):   38.486 s … 41.364 s    10 runs


After
  Time (mean ± σ):     37.416 s ±  1.405 s    [User: 42.558 s, System: 6.299 s]
  Range (min … max):   36.015 s … 39.096 s    5 runs

Test Plan

CI + unit tests

Test links

https://deploy-preview-9798--docusaurus-2.netlify.app/

@slorber slorber added pr: performance This PR does not add a new behavior, but existing behaviors will be more memory- / time-efficient. to backport This PR is planned to be backported to a stable version of Docusaurus labels Jan 26, 2024
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jan 26, 2024
Copy link

netlify bot commented Jan 26, 2024

[V2]

Name Link
🔨 Latest commit 0d2f756
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/65c50060d7a5e60008976a18
😎 Deploy Preview https://deploy-preview-9798--docusaurus-2.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.

Copy link

github-actions bot commented Jan 26, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 78 🟢 98 🟢 96 🟢 100 🟠 88 Report
/docs/installation 🟠 87 🟢 96 🟢 100 🟢 100 🟠 88 Report
/docs/category/getting-started 🟠 76 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog 🟠 71 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 65 🟢 96 🟢 100 🟢 100 🟠 88 Report
/blog/tags/release 🟠 71 🟢 100 🟢 100 🟠 80 🟠 88 Report
/blog/tags 🟠 76 🟢 100 🟢 100 🟢 90 🟠 88 Report

Copy link

github-actions bot commented Jan 26, 2024

Size Change: 0 B

Total Size: 986 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 75.1 kB
website/build/assets/css/styles.********.css 114 kB
website/build/assets/js/main.********.js 759 kB
website/build/index.html 37.9 kB

compressed-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Argos Add this label to run UI visual regression tests. See argos.yml GH action. CLA Signed Signed Facebook CLA pr: performance This PR does not add a new behavior, but existing behaviors will be more memory- / time-efficient. to backport This PR is planned to be backported to a stable version of Docusaurus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants