What version of starlight are you using?
0.25.2
What version of astro are you using?
4.13.4
What package manager are you using?
npm
What operating system are you using?
Mac
What browser are you using?
Chrome
Describe the Bug
On Starlight sites with a large (thousands of items) sidebar, which may be filtered with a Sidebar override (i.e to the current folder), individual pages will build slower as the sidebar size increases.
For example, with cloudflare/cloudflare-docs as an example, there are ~4,000 pages and each top-level folder within src/content/docs is an autogenerate entry for the sidebar.
As part of generateRouteData, getSidebar is called on each page with the current page's path (to mark a given page as current). With a very large sidebar, this can represent a large amount of the time spent rendering a page.
NodeJS Dev Tools profile:

Full build flamegraph:

I will try and follow-up with a proper MRE in StackBlitz!
Link to Minimal Reproducible Example
https://github.com/cloudflare/cloudflare-docs
Participation