Skip to content

chore: add benchmarks - #4157

Open
ematipico wants to merge 1 commit into
mainfrom
ci/setup-codspeed
Open

chore: add benchmarks#4157
ematipico wants to merge 1 commit into
mainfrom
ci/setup-codspeed

Conversation

@ematipico

Copy link
Copy Markdown
Member

Description

This PR benchmarks to starlight, which can be run locally and via CodSpeed.

They are four benchmarks:

  • many starlight components in one page
  • locales
  • deep nested sidebar
  • generateRouteData

The latter is a "functional" benchmark, meaning it needs a different setup that the others need, and that's why there are two separate configs.

@changeset-bot

changeset-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1adc654

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify

netlify Bot commented Aug 26, 2026

Copy link
Copy Markdown

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 1adc654
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/6a8ef251e210560008703a3a
😎 Deploy Preview https://deploy-preview-4157--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 94 (🔴 down 6 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (🔴 down 8 from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added 🚨 action Changes to GitHub Action workflows 🌟 core Changes to Starlight’s main package labels Aug 26, 2026
@astrobot-houston

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
/index.html 6.1 KB (0%)
/guides/example/index.html 6.13 KB (0%)
/_astro/*.js 25.44 KB (0%)
/_astro/*.css 14.7 KB (0%)

@codspeed-hq

codspeed-hq Bot commented Aug 26, 2026

Copy link
Copy Markdown

Congrats! CodSpeed is installed 🎉

🆕 5 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks


Open in CodSpeed

@HiDeoo

HiDeoo commented Aug 26, 2026

Copy link
Copy Markdown
Member

I did not review all files yet, but I have to run for now so sharing what I found so far.

  • We need to add new directories in the packages/starlight/.npmignore file.
  • Looks like this introduces a peer dependency issue as @codspeed/vitest-plugin does not yet officially support Vite 8 (draft PR opened but not yet merged)
  • I wonder if we should experiment with the walltime mode for builds (reference).

    Macro runners are ideal when you need to measure

    • System calls and I/O operations that are excluded from the CPU Simulation instrument
    • End-to-end performance including network, disk, and system interactions
    • Walltime benchmarks where actual execution time matters
    • Integration tests that require a complete system environment
  • To follow up on Chris's message, I think there may be an issue with the way the PR setup things where in CodSpeed, our setup and teardown may not even called. There is a old closed and unmerged PR to fix this and the current code here and here still seems to only call beforeAll, beforeEach, afterEach, and afterAll(but not setup and teardown used in the PR).

Depending on the time it ends up taking in the end, we should also see if we need to consider triggering benchmarks on labels like pre-releases to avoid running it on too many PRs unnecessarily, e.g. PRs adding or updating translations, adding an icon, CSS updates, etc.

@delucis delucis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the idea to set this up and leading the effort @ematipico 🙌

I left some detailed comments.

Also one high-level thought: at least in our initial run, the three benchmarks for astro build gave basically identical results (24.9–25.0 seconds each). I wonder if that suggests we could just combine the three into one and get just as much benefit? It suggests there is a negligible difference between the components/sidebars/locales customizations so I guess we’re mostly measuring other parts of the build 3 times? What do you think?

cache: pnpm
- run: pnpm i --filter @astrojs/starlight --filter @bench/components --filter @bench/large-sidebar --filter @bench/locales
- name: Run benchmarks
uses: CodSpeedHQ/action@562878fc153dee6c0f3719c99b1799334cfc3ccc # v5

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn’t find this SHA in their repo? This would be the most recent release from before our 3-day embargo window:

Suggested change
uses: CodSpeedHQ/action@562878fc153dee6c0f3719c99b1799334cfc3ccc # v5
uses: CodSpeedHQ/action@4296e51e7041e24dadb86d1d6e8b9320d223dbe8 # v5.0.3

Comment thread .gitignore
build?: Pick<AstroConfig['build'], 'format'>;
trailingSlash?: AstroConfig['trailingSlash'];
command?: 'dev' | 'build' | 'preview';
snapshotSerializers?: boolean;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a nit, but it might be clearer how this works if we name this disableSnapshotSerializers and set it to true in the benchmarks currently passing false.

title: 'Starlight benchmarks',
sidebar: [{ label: 'Reference', items: [{ autogenerate: { directory: 'reference' } }] }],
},
{ snapshotSerializers: false }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might also be good to have a comment here explaining why these serializers cause issues and need to be disabled.


export default defineConfig({
plugins: [codspeedPlugin()],
benchmark: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s a type error here currently: https://github.com/withastro/starlight/actions/runs/32977984781/job/98207323537?pr=4157#step:7:12

Object literal may only specify known properties, and 'benchmark' does not exist in type 'ViteUserConfigExport'.

},
test: {
fileParallelism: false,
hookTimeout: 600_000,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 10 minutes. I guess we don’t expect things to take that long so maybe a lower timeout could make sense?

test: {
...config.test,
fileParallelism: false,
hookTimeout: 600_000,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here, maybe should be a lower timeout?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚨 action Changes to GitHub Action workflows 🌟 core Changes to Starlight’s main package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants