Skip to content

Conversation

jordanoverbye
Copy link

@jordanoverbye jordanoverbye commented Oct 14, 2025

What's the problem this PR addresses?

All workspace patterns — including static paths like packages/foo/bar — are passed to fast-glob for resolution, even though they might not contain glob syntax which adds unnecessary overhead.

I work in a large monorepo with over 5,000 workspaces where project.setupWorkspaces() takes 920ms on average. The changes in this PR has reduced this setup time in our repo by about 21% (920ms => 719ms).

How did you fix it?

Introduced an opt-in enableWorkspacePatternAnalysis configuration option. When enabled, workspace patterns are split into static patterns (resolved directly) and dynamic patterns (resolved via fast-glob).

Defaults to false to preserve exisiting behaviour and this primarily benefits projects with mostly static workspace patterns.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@jordanoverbye jordanoverbye changed the title Add enableWorkspacePatternAnalysis configuration option Add opt-in optimization for static workspace patterns in 'project.setupWorkspaces' Oct 14, 2025
@jordanoverbye jordanoverbye force-pushed the joverbye-workspaces-optimisation branch 2 times, most recently from 9394d37 to 48fa100 Compare October 14, 2025 02:20

expect(manifest.resolutions).toEqual({
[`no-deps@npm:1.0.0`]: expect.stringMatching(/^patch:no-deps/),
[`no-deps@npm:1.0.0`]: expect.stringMatching(/^patch:no-deps/),
Copy link
Author

Choose a reason for hiding this comment

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

This change was auto-generated when running yarn test:lint --fix

Without this change, I get the following error in CI:

/home/runner/work/berry/berry/packages/acceptance-tests/pkg-tests-specs/sources/commands/patchCommit.test.ts
Error:   117:1  error  Expected indentation of 10 spaces but found 8  @stylistic/indent

}),
);

test(
Copy link
Author

Choose a reason for hiding this comment

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

The two tests that I've added here are duplicates of tests that already exist in this file, however these new tests have the enableWorkspacePatternAnalysis configuration turned on.

@jordanoverbye jordanoverbye force-pushed the joverbye-workspaces-optimisation branch from 48fa100 to 4533276 Compare October 14, 2025 09:17
@jordanoverbye jordanoverbye force-pushed the joverbye-workspaces-optimisation branch from 4533276 to 8d1d7ae Compare October 14, 2025 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants