berry icon indicating copy to clipboard operation
berry copied to clipboard

Add opt-in optimization for static workspace patterns in 'project.setupWorkspaces'

Open jordanoverbye opened this issue 4 months ago • 0 comments

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

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

jordanoverbye avatar Oct 14 '25 02:10 jordanoverbye