perf(core): disable Rspack parallelCodeSplitting temporarily (#11178)

Co-authored-by: slorber <749374+slorber@users.noreply.github.com>
This commit is contained in:
Sébastien Lorber 2025-05-14 17:01:54 +02:00 committed by GitHub
parent dbc4ed2c15
commit e839b67034
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 25 additions and 5 deletions

3
.gitignore vendored
View file

@ -48,3 +48,6 @@ website/i18n/**/*
website/rspack-tracing.json
website/bundler-cpu-profile.json
website/profile.json.gz

View file

@ -31,8 +31,9 @@
"build:website:deployPreview": "yarn build:website:deployPreview:testWrap && yarn build:website:deployPreview:build",
"build:website:fast": "yarn workspace website build:fast",
"build:website:fast:rsdoctor": "yarn workspace website build:fast:rsdoctor",
"build:website:fast:profile": "yarn workspace website build:fast:profile",
"build:website:en": "yarn workspace website build --locale en",
"profile:bundle:cpu": "yarn workspace website profile:bundle:cpu:profile",
"profile:bundle:samply": "yarn workspace website profile:bundle:samply",
"clear:website": "yarn workspace website clear",
"serve:website": "yarn workspace website serve",
"serve:website:baseUrl": "serve website",

View file

@ -71,7 +71,10 @@ export const LAST_UPDATE_FALLBACK: LastUpdateData = {
export async function getLastUpdate(
filePath: string,
): Promise<LastUpdateData | null> {
if (process.env.NODE_ENV !== 'production') {
if (
process.env.NODE_ENV !== 'production' ||
process.env.DOCUSAURUS_DISABLE_LAST_UPDATE === 'true'
) {
// Use fake data in dev/test for faster development.
return LAST_UPDATE_FALLBACK;
}

View file

@ -187,6 +187,10 @@ export async function createBaseConfig({
// @ts-expect-error: Rspack-only, not available in Webpack typedefs
incremental: !isProd && !process.env.DISABLE_RSPACK_INCREMENTAL,
// TODO re-enable later, there's an Rspack performance issue
// see https://github.com/facebook/docusaurus/pull/11178
parallelCodeSplitting: false,
...PersistentCacheAttributes,
};
}
@ -249,14 +253,14 @@ export async function createBaseConfig({
modules: ['node_modules', path.join(siteDir, 'node_modules')],
},
optimization: {
// The optimizations.concatenateModules is expensive
// The optimization.concatenateModules is expensive
// - On the server, it's not useful to run it at all
// - On the client, it leads to a ~3% JS assets total size decrease
// Let's keep it by default, but large sites may prefer faster builds
// See also https://github.com/facebook/docusaurus/pull/11176
concatenateModules: !isServer,
// The optimizations.mergeDuplicateChunks is expensive
// The optimization.mergeDuplicateChunks is expensive
// - On the server, it's not useful to run it at all
// - On the client, we compared assets/js before/after and see 0 change
// `du -sk js-before js-after` => the JS assets have the exact same size

View file

@ -266,6 +266,8 @@ Rspack
rspack
Rspress
rtcts
Samply
samply
saurus
Scaleway
Sebastien

View file

@ -23,7 +23,8 @@
"build:blogOnly": "cross-env yarn build --config=docusaurus.config-blog-only.js",
"build:fast": "cross-env BUILD_FAST=true yarn build --locale en",
"build:fast:rsdoctor": "cross-env BUILD_FAST=true RSDOCTOR=true yarn build --locale en",
"build:fast:profile": "cross-env BUILD_FAST=true node --cpu-prof --cpu-prof-dir .cpu-prof ./node_modules/.bin/docusaurus build --locale en",
"profile:bundle:cpu": "DOCUSAURUS_EXIT_AFTER_BUNDLING=true node --cpu-prof --cpu-prof-dir .cpu-prof ./node_modules/.bin/docusaurus build --locale en",
"profile:bundle:samply": "./profileSamply.sh",
"netlify:build:production": "yarn docusaurus write-translations && yarn netlify:crowdin:delay && yarn netlify:crowdin:uploadSources && yarn netlify:crowdin:downloadTranslations && yarn build",
"netlify:build:branchDeploy": "yarn build",
"netlify:build:deployPreview": "yarn build",

6
website/profileSamply.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
echo "This Samply profiling script doesn't work when it's run with Yarn, but you can run it manually instead"
samply record -- DOCUSAURUS_EXIT_AFTER_BUNDLING=true node --perf-prof --perf-basic-prof --interpreted-frames-native-stack ./node_modules/.bin/docusaurus build --locale en