Skip to content

Commit e839b67

Browse files
authored
perf(core): disable Rspack parallelCodeSplitting temporarily (#11178)
Co-authored-by: slorber <[email protected]>
1 parent dbc4ed2 commit e839b67

File tree

7 files changed

+25
-5
lines changed

7 files changed

+25
-5
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ website/i18n/**/*
4848

4949
website/rspack-tracing.json
5050
website/bundler-cpu-profile.json
51+
website/profile.json.gz
52+
53+

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
"build:website:deployPreview": "yarn build:website:deployPreview:testWrap && yarn build:website:deployPreview:build",
3232
"build:website:fast": "yarn workspace website build:fast",
3333
"build:website:fast:rsdoctor": "yarn workspace website build:fast:rsdoctor",
34-
"build:website:fast:profile": "yarn workspace website build:fast:profile",
3534
"build:website:en": "yarn workspace website build --locale en",
35+
"profile:bundle:cpu": "yarn workspace website profile:bundle:cpu:profile",
36+
"profile:bundle:samply": "yarn workspace website profile:bundle:samply",
3637
"clear:website": "yarn workspace website clear",
3738
"serve:website": "yarn workspace website serve",
3839
"serve:website:baseUrl": "serve website",

packages/docusaurus-utils/src/lastUpdateUtils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ export const LAST_UPDATE_FALLBACK: LastUpdateData = {
7171
export async function getLastUpdate(
7272
filePath: string,
7373
): Promise<LastUpdateData | null> {
74-
if (process.env.NODE_ENV !== 'production') {
74+
if (
75+
process.env.NODE_ENV !== 'production' ||
76+
process.env.DOCUSAURUS_DISABLE_LAST_UPDATE === 'true'
77+
) {
7578
// Use fake data in dev/test for faster development.
7679
return LAST_UPDATE_FALLBACK;
7780
}

packages/docusaurus/src/webpack/base.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ export async function createBaseConfig({
187187
// @ts-expect-error: Rspack-only, not available in Webpack typedefs
188188
incremental: !isProd && !process.env.DISABLE_RSPACK_INCREMENTAL,
189189

190+
// TODO re-enable later, there's an Rspack performance issue
191+
// see https://github.com/facebook/docusaurus/pull/11178
192+
parallelCodeSplitting: false,
193+
190194
...PersistentCacheAttributes,
191195
};
192196
}
@@ -249,14 +253,14 @@ export async function createBaseConfig({
249253
modules: ['node_modules', path.join(siteDir, 'node_modules')],
250254
},
251255
optimization: {
252-
// The optimizations.concatenateModules is expensive
256+
// The optimization.concatenateModules is expensive
253257
// - On the server, it's not useful to run it at all
254258
// - On the client, it leads to a ~3% JS assets total size decrease
255259
// Let's keep it by default, but large sites may prefer faster builds
256260
// See also https://github.com/facebook/docusaurus/pull/11176
257261
concatenateModules: !isServer,
258262

259-
// The optimizations.mergeDuplicateChunks is expensive
263+
// The optimization.mergeDuplicateChunks is expensive
260264
// - On the server, it's not useful to run it at all
261265
// - On the client, we compared assets/js before/after and see 0 change
262266
// `du -sk js-before js-after` => the JS assets have the exact same size

project-words.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ Rspack
266266
rspack
267267
Rspress
268268
rtcts
269+
Samply
270+
samply
269271
saurus
270272
Scaleway
271273
Sebastien

website/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"build:blogOnly": "cross-env yarn build --config=docusaurus.config-blog-only.js",
2424
"build:fast": "cross-env BUILD_FAST=true yarn build --locale en",
2525
"build:fast:rsdoctor": "cross-env BUILD_FAST=true RSDOCTOR=true yarn build --locale en",
26-
"build:fast:profile": "cross-env BUILD_FAST=true node --cpu-prof --cpu-prof-dir .cpu-prof ./node_modules/.bin/docusaurus build --locale en",
26+
"profile:bundle:cpu": "DOCUSAURUS_EXIT_AFTER_BUNDLING=true node --cpu-prof --cpu-prof-dir .cpu-prof ./node_modules/.bin/docusaurus build --locale en",
27+
"profile:bundle:samply": "./profileSamply.sh",
2728
"netlify:build:production": "yarn docusaurus write-translations && yarn netlify:crowdin:delay && yarn netlify:crowdin:uploadSources && yarn netlify:crowdin:downloadTranslations && yarn build",
2829
"netlify:build:branchDeploy": "yarn build",
2930
"netlify:build:deployPreview": "yarn build",

website/profileSamply.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
4+
echo "This Samply profiling script doesn't work when it's run with Yarn, but you can run it manually instead"
5+
6+
samply record -- DOCUSAURUS_EXIT_AFTER_BUNDLING=true node --perf-prof --perf-basic-prof --interpreted-frames-native-stack ./node_modules/.bin/docusaurus build --locale en

0 commit comments

Comments
 (0)