Build performance optimizations for projects with large sidebars#2252
Build performance optimizations for projects with large sidebars#2252delucis merged 8 commits intowithastro:mainfrom
Conversation
|
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
* main: (240 commits) i18n(de): update some files for consistency in German language (withastro#2502) i18n(zh-cn): Update `plugins.mdx` (withastro#2501) i18n(de): translate guides/pages (withastro#2469) i18n(de): translate components/code (withastro#2457) i18n(de): translate components/using-components (withastro#2455) [ci] format i18n(de): translate guides/site-search (withastro#2481) i18n(de): update translation guides/customization (withastro#2475) i18n(de): update translation manual-setup (withastro#2479) i18n(de): update translation reference/overrides (withastro#2480) i18n(de): translate reference/plugins (withastro#2464) i18n(de): update translation guides/authoring-content (withastro#2458) [ci] format i18n(de): update translation reference/configuration (withastro#2459) i18n(de): update translation reference/frontmatter (withastro#2470) [ci] format i18n(de): update translation guides/i18n (withastro#2476) i18n(de): update `resources/plugins.mdx` (withastro#2498) i18n(ko-KR): update `plugins.mdx` (withastro#2500) i18n(fr): Update `resources/plugins` from withastro#2493 (withastro#2496) ...
|
Undrafting the PR as I've been playing quite a bit with the changes and didn't see any downside to the current approach. I still want to do a little bit of play-testing with some SSR scenarios but I thought I might as well undraft the PR before I forget as usual and in case some users want to provide some feedback in the meantime. |
delucis
left a comment
There was a problem hiding this comment.
Went through this again now and seems really solid. I think I’m happy with this as-is 🚀
Co-authored-by: Kevin <46791833+kevinzunigacuellar@users.noreply.github.com>
* main: (27 commits) i18n(ko-KR): update `site-search.mdx` [ci] release (withastro#2590) Support passing more options to the DocSearch component (withastro#2589) [ci] release (withastro#2587) Add changeset for withastro#2252 (withastro#2588) [ci] format Update dev dependencies (withastro#2582) Build performance optimizations for projects with large sidebars (withastro#2252) Fix a11y CI workflow (withastro#2503) Update `astro-expressive-code` to v0.38 (withastro#2551) Added social icon for Nostr (withastro#2579) [ci] format docs(showcase): add docs.reactbricks.com to showcase (withastro#2586) i18n(ja): Update site-search.mdx (withastro#2577) i18n(ja): Update pages.mdx (withastro#2576) i18n(fr): Update `reference/plugins.mdx` from withastro#2549 (withastro#2574) [ci] format docs: update showcase-sites.astro (withastro#2562) Throw an error if a showcase image does not have the required dimensions (withastro#2573) i18n(ja): Update frontmatter.md (withastro#2566) ...
…hastro#2252) Co-authored-by: Kevin <46791833+kevinzunigacuellar@users.noreply.github.com> Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

Description
This PR is a draft experimenting with a new approach to fix #2215 by caching generated sidebars per locale to avoid regenerating them for each page during the build process.
A few details about the approach:
Mapat the moment.docscontent collections pages and<StarlightPage>not specifying a custom sidebar (which means the sidebar generated based on the globalsidebarconfig is used).<StarlightPage>with a custom sidebar would probably require a hash of the custom sidebar config so I decided to keep it simple for now and it's not required to get an idea of the potential performance improvements (there is also no guarantee that generating such a hash would not kill the performance improvements from the caching).Here are some benchmarks I ran on my machine:
Starlight Docs
Before:
After:
Cloudflare Docs (no patch)
astro checkhas been removed from thebuildnpm script as it's not really relevant for this benchmark.Before:
After:
Cloudflare Docs (with patch)
astro checkhas been removed from thebuildnpm script as it's not really relevant for this benchmark.Before:
After:
A few interesting points: