Build time decreased x5 when migrating from docosaurus 2.4 to 3.9 #11664
-
|
Hey Docosaurus team in Harvester we try to move to latest 3.9 from 2.4, but our original build times on 2.4 from ~11 minutes in total for pipeline and ~5-7 minutes for the build itself: https://github.com/harvester/docs/actions/runs/21025102637/job/60447639391 (~11 minutes) Where we drew inspiration from this codebase to do the optimization: docusaurus/website/docusaurus.config.ts Lines 182 to 203 in 1f845e6 and that's how we made our builds that fast. But now following the documentation setting simply the experimental faster and v4 to true yields a lot slower results for the same step here is a build adopting this: https://github.com/harvester/docs/actions/runs/20988131354/job/60326759049 (~50 minutes) TL:DR we went from this in to this in Also went over this discussion: #11140 and attempted adopting the suggestions: also tried to fine tune: So nothing did better than ~30 minutes of build time. The original code which is in the PR is the best build time I could achieve, but never around the current ~7-8 minutes. Is there a way to achieve that sub 10 minute speed in 3.9? Thank you in advance for the help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 20 replies
-
|
Hey I understand that your build time increased x5 (and did not decrease) It would be helpful to link to the original PR: harvester/docs#945 With Docusaurus Faster, it's supposed to be... faster. And you shouldn't use a custom SWC loader because it uses an built-in Rspack SWC loader by default, which would be faster than using a js-based swc loader like you did before. Have you tried running your build locally? Is it as slow as on CI runs? Are you comparing cold or warm rebuilds?
Before trying to optimize on your CI, it would be easier to optimize locally. Can you please share the time it takes to build locally?
You can get additional logs to figure out what is slow thanks to this env variable: export DOCUSAURUS_PERF_LOGGER=truePlease share your full logs so that we identify which step is slow, for both a cold build and a warm rebuild: export DOCUSAURUS_PERF_LOGGER=true
yarn docusaurus clear
yarn docusaurus build
yarn docusaurus build |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for this! I had also been having incredibly slow build times (1+ hours) with 3.9 that seemed tangentially related to the API docs. This improvement, in combination with a few other changes, have returned Docusaurus to normal operation for me. This is for a somewhat large (~1500 page) site with multiple instances, versioning, remark plugins, and API docs. My PR has more details about what I changed to get builds working again: airbytehq/airbyte#72503 @slorber and @sserrata one thing that may be of interest to you: the single most important factor in improving build speed was downgrading from Node 22 to 20. With v20, cold builds finish in under 5 minutes and warm builds in 1-2 minutes. I'm not sure if v24 is any better than 22. I still have to try it. I can open an issue and provide some logs if this is something you would like to investigate further. |
Beta Was this translation helpful? Give feedback.


Ok, I opened PaloAltoNetworks/docusaurus-openapi-docs#1279 - appreciate any assistance with review or even just feedback on the approach. Given the possible performance gains, I opted to make
externalJsonPropsenabled by default, with the option to disable on a per-API basis.